Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2018-04-24

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:01 mcmillhj joined #perl6
00:01 w_richard_w joined #perl6
00:03 Zoffix All tests successful yey
00:03 Geth ¦ doc/post-release-2018.04: 2e96dd3894 | (Zoffix Znet)++ | doc/Language/variables.pod6
00:03 Geth ¦ doc/post-release-2018.04: Fix articles
00:03 Geth ¦ doc/post-release-2018.04: review: https://github.com/perl6/doc/commit/2e96dd3894
00:03 Geth ¦ doc/post-release-2018.04: d13f6424b7 | (Zoffix Znet)++ | doc/Language/variables.pod6
00:03 Geth ¦ doc/post-release-2018.04: Merge branch 'master' into post-release-2018.04
00:03 Geth ¦ doc/post-release-2018.04: review: https://github.com/perl6/doc/commit/d13f6424b7
00:06 BenGoldberg joined #perl6
00:19 mcmillhj joined #perl6
00:21 lizmat joined #perl6
00:32 mcmillhj joined #perl6
00:44 mcmillhj joined #perl6
00:47 aindilis joined #perl6
00:56 mcmillhj joined #perl6
00:58 Kaiepi jesus i didn't notice how bad the boilerplate in my bot was until i shortened ~200 lines of code to this https://hastebin.com/legawomoqu.pl
01:00 Zoffix Doesn't that code have a data race? You're pushing to @lines from two separate threads.
01:00 Zoffix I think a Channel is better for that (since it protects for such cases)
01:00 Kaiepi hm
01:01 Kaiepi depends, is any of rakudo's build scripts concurrent?
01:01 Kaiepi wait i think the tests are
01:02 Zoffix No idea, but does it matter? If either prints to both to STDERR and STDOUT, they don't need to be concurrent
01:02 Kaiepi probbaly not
01:05 Kaiepi oh good channels work roughly the same as golang channels
01:05 AlexDaniel just use react maybe?
01:05 AlexDaniel then you can just push into arrays just fine
01:06 pharv joined #perl6
01:06 AlexDaniel also .stdout.tap does not tap on lines
01:06 Zoffix What does it tap on?
01:06 AlexDaniel chunks
01:06 Zoffix Of what size?
01:06 Zoffix And how to control them
01:06 Zoffix ?
01:07 AlexDaniel dunno to both, but you can use .stdout.lines to get lines
01:07 Kaiepi it taps each 80 characters from what i've seen
01:08 mcmillhj joined #perl6
01:08 Kaiepi lines would be better though
01:08 AlexDaniel Kaiepi: maybe see this as a reference: https://github.com/perl6/whateverable/blob/bc77c2f7ecccc4587a3a6ee3b25887bd41e8f4ba/lib/Whateverable.pm6#L224-L268
01:09 Kaiepi ohhh
01:09 Zoffix This gives 20030 consistently with and without atomicint: https://gist.github.com/zoffixznet/ad3f569c6759627ea63342baab369ed5
01:09 Kaiepi see i've read the docs for react, but i still didn't understand how it works
01:09 Zoffix So maybe there isn't a race.
01:10 Zoffix Also, don't get where the extra 30 come from :S
01:10 Zoffix I guess the chunking
01:10 Zoffix yeah, doing stdout.line gives 20000 exact
01:10 elcaro[m] joined #perl6
01:10 AlexDaniel Zoffix: try perl5 maybe
01:11 AlexDaniel it could be that perl6 process is printing just too slow?
01:11 * AlexDaniel tries himself
01:12 Kaiepi wait does react work sort of like select in golang?
01:12 Kaiepi except not specific to channels
01:13 AlexDaniel Zoffix: haha yea seems to be different with perl5
01:15 AlexDaniel wait…
01:15 AlexDaniel nah that's something else
01:16 AlexDaniel I had this https://gist.github.com/AlexDaniel/6ce255c821a6e60e7e74dfbf3eadbddf
01:16 AlexDaniel which outputs different numbers
01:16 AlexDaniel but I guess for a different reason
01:16 Zoffix That's the chunking
01:18 Zoffix .tell pmurias did some initial debugging for JVM issue, but giving up. Maybe it'll help you fix the problem: https://github.com/rakudo/rakudo/issues/1765#issuecomment-383771805
01:18 yoleaux Zoffix: I'll pass your message to pmurias.
01:19 AlexDaniel anyway, I don't know why it works, but it shouldn't
01:20 Zoffix What is?
01:20 AlexDaniel pushing to the same array from two taps
01:21 Zoffix Well, I'm guessing the two taps are fed from one event loop so it's just one thread actually or something?
01:21 Zoffix Because it's one proc async
01:22 mcmillhj joined #perl6
01:22 AlexDaniel yeah, looks so
01:22 Zoffix or maybe not... sticking a `sleep` in one doesn't block the other
01:22 * Zoffix doesn't know much about this stuff
01:22 AlexDaniel at least according to “say $*THREAD”
01:24 Zoffix or it's the affinity worker....
01:25 Zoffix Yup: *** Error in `/home/zoffix/rakudo/install/bin/moar': double free or corruption (!prev): 0x00007f87d86955c0 ***
01:25 Zoffix Kaiepi: yeah, it's not thread safe.
01:25 AlexDaniel Zoffix: how did you get it to do that?
01:26 Zoffix If you stick ` sleep 2` into one of the code blocks, a second affinity worker will spawn and it'll be two threads. So the number of used threads depends on how busy the system is. The supervisor checks every 100ms (or 10ms) to see if it needs to spawn more workers and that sleep forces it to spawn
01:26 Kaiepi damn
01:27 Kaiepi i tried with channels but $c.list hanged regardless of if the channel was closed or not
01:28 AlexDaniel just use react, it's easier
01:28 Zoffix Kaiepi: react version: https://gist.github.com/zoffixznet/cb002b086ded5fde2e10f3ad9057c094
01:28 Zoffix This one is safe, 'cause only one whenever is run at a time. It also gives you better error reporting when stuff explodes
01:29 Kaiepi how does react decide which whenever statement to run?
01:30 Kaiepi that's what confuses me about it
01:31 Zoffix As for $c.list hanging... I'm guessing you forgot to .close the Channel
01:31 Zoffix Kaiepi: it's asynchronous. So it runs whenever the event occurs
01:32 AlexDaniel well, if it's running something else already
01:32 AlexDaniel not*
01:32 Zoffix yeah
01:32 rjt_pl joined #perl6
01:32 Zoffix it queues it up to run, I guess I should say
01:32 Kaiepi ohh
01:33 AlexDaniel so it's doing synchronous processing of asynchronous events, sorta :)
01:33 Kaiepi zoffix i closed the channel before doing .list
01:33 Zoffix m: my Channel $c .= new; $c.send: "meows"; $c.send: "foos"; $c.send: 42; $c.close; say $c.list
01:33 camelia rakudo-moar d4a6b92f3: OUTPUT: «(meows foos 42)␤»
01:33 Kaiepi i checked Channel.pm6 and it's trying to use .Seq on itself, but it doesn't seem to have a Seq method in it or its roles...?
01:34 Kaiepi ok weird
01:34 Zoffix s: Channel.new, 'Seq', \()
01:34 SourceBaby Zoffix, Sauce is at https://github.com/rakudo/rakudo/blob/a138dcf50/src/core/Any.pm6#L73
01:34 Zoffix It's provided by Any
01:34 Kaiepi oh
01:34 perlawhirl m: say (^10).head('5')
01:34 camelia rakudo-moar d4a6b92f3: OUTPUT: «This type cannot unbox to a native integer: P6opaque, Str␤  in block <unit> at <tmp> line 1␤␤»
01:34 perlawhirl should .head be Cool ?
01:34 perlawhirl be Cool, man
01:35 Zoffix I really wish we establish a language-wide policy on such thing rather than fixing things piece-meal
01:35 Zoffix m: say substr "abc", "1", "2"
01:35 camelia rakudo-moar d4a6b92f3: OUTPUT: «bc␤»
01:35 Zoffix like here it works. There it don't
01:35 Zoffix .splice used to coerce, now it doesn't.
01:37 AlexDaniel Zoffix: any downsides to coercing everywhere?
01:37 Zoffix m: say substr "abc", ("maybe",), <there are>
01:37 camelia rakudo-moar d4a6b92f3: OUTPUT: «bc␤»
01:38 mcmillhj joined #perl6
01:38 perlawhirl maybe a good rule might be, if the argument can only ever be an Int, then it should be Cool (whether or not that criteria should be wider than Int is up for discussion)
01:39 Zoffix AlexDaniel: also, either slower speed or larger size with all the multies
01:39 Zoffix m: say [].^lookup("splice").candidates.elems
01:39 camelia rakudo-moar d4a6b92f3: OUTPUT: «31␤»
01:39 Zoffix Like this would end up prolly around 50-60 candidates.
01:40 * AlexDaniel puts his head in the sand
01:40 perlawhirl If I'm feeling bitter, I would say that making Lists Cool feels like it was something that was done to make the language more like perl5 that ended up being a mistake :S
01:40 Zoffix (and don't tell me the "torture the developer" stuff; there won't be any developers to torture when the code is an unmaintable pile)
01:41 Kaiepi zoffix: issue was i was closing the channel before awaiting the promise
01:41 Kaiepi instead of after
01:41 Zoffix ah
01:42 Zoffix perlawhirl: in an alternate universe, there's a perlawhirl who's bitter because they have to stick explicit .elems all over the place :)
01:55 AlexDaniel just a prefix +
01:55 Zoffix You'll get 1
01:55 Zoffix But it's not Cool anymore. It doesn't know how to behave like a number anymore.
01:55 Kaiepi btw thanks for the help
01:55 AlexDaniel :'(
01:55 AlexDaniel right
01:55 Zoffix Well, I guess you won't get one either, because I was thinking you'd get a 1-el list :)
01:55 Zoffix m: say +class {}.new
01:55 camelia rakudo-moar d4a6b92f3: OUTPUT: «Cannot resolve caller Numeric(<anon|1>: ); none of these signatures match:␤    (Mu:U \v: *%_)␤  in block <unit> at <tmp> line 1␤␤»
01:55 Zoffix you'd get that :D
01:55 AlexDaniel .oO( all universes suck )
01:55 TEttinger I gotta say, I've been in here for a while now and I still have no understanding of the names Perl6 uses for almost anything
01:55 Zoffix Like what?
01:55 TEttinger Cool
01:55 Zoffix It's "Convenient OO Loop"
01:55 Zoffix Also a pun.
01:55 TEttinger it's like there's a rule that unless it's an inside joke it can't be made permanent
01:55 Zoffix Like MoarVM is "Metamodel On A Runtime"
01:55 AlexDaniel .oO( Strinty? Numstry? )
01:56 ilbot3 joined #perl6
01:56 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:56 perlawhirl TEttinger: The use of the '+' infix means _numeric_ addition, so the list is coerced to it's number of elements (ie. 3)
01:56 AlexDaniel` yeah, number of elements + 1
01:56 perlawhirl so it's doing 3 + 4
01:56 AlexDaniel joined #perl6
01:56 perlawhirl i mean ... 3 + 1
01:57 perlawhirl m: say ('alpha', 'beta', 'gamma') + 1
01:57 camelia rakudo-moar d4a6b92f3: OUTPUT: «4␤»
01:57 TEttinger so... ~ is string concatenation but ~~ is smart match?
01:57 perlawhirl Yes
01:58 AlexDaniel and there's also ≅ :)
01:58 AlexDaniel for approximate equality, but no ≈
02:00 TEttinger
02:01 AlexDaniel that's a cool character
02:01 perlawhirl TEttinger: It's mainly nice for checking number of elems in conditions, eg. if @things < 5 { ... }
02:02 perlawhirl similar to addition '<' means numerically less than, so arguments are coerced to numbers if possible
02:04 TEttinger mmm
02:06 Herby_ joined #perl6
02:06 Herby_ o/
02:07 Herby_ \o
02:08 TEttinger I dunno. as I've gotten more opinionated on programming, I've found implicit behavior to be counterproductive even if it saves some keystrokes. having to consult a manual and hoping it adequately describes some corner case that's causing me issues takes a lot more time than typing out what I mean
02:09 TEttinger a friend hit a worst-case scenario for this in Go, recently
02:12 TEttinger https://golang.org/pkg/net/url/#URL.Parse was failing to fail on a clearly-invalid URL, the string containing only the ASCII char 127 (a control char, often DEL in older encodings)
02:13 TEttinger going through comments in the code he found that it had been changed to address a Git issue. that issue cross-referenced the actual issue, which was that it was broken in the first release, was fixed but that broke code that expected the parser to be incorrect, so they had to un-fix the correct code for compatibility
02:14 mcmillhj joined #perl6
02:18 perlawhirl yeah I tend to agree on the opinionated thing most of the time, which is why i'll typically write `@things.elems`
02:19 perlawhirl but i constantly appreciate that i can treat the string '10' as a number in perl if i want to
02:20 perlawhirl particualy when translating things to other languages, and realising to make calls to `int()` in a bunch of places
02:21 perlawhirl so I'm not against Cool in principal... but making Lists Cool is the source of quite a few traps that I'd happy do without
02:21 perlawhirl happily*
02:25 mcmillhj joined #perl6
02:38 Herby_ joined #perl6
02:44 ufobat_ joined #perl6
02:45 mcmillhj joined #perl6
02:49 AlexDaniel implicit behavior being that lists turn into the number of elements in numeric contexts?
02:57 mcmillhj joined #perl6
03:03 MasterDuke i think List.contains is a trap (implicit behavior being it stringifies the list)
03:05 lookatme good noon
03:06 lookatme m: say (1, 2, 3, ).contains(1)
03:06 camelia rakudo-moar d4a6b92f3: OUTPUT: «True␤»
03:07 lookatme m: say (1, 2, 3, ).contains(12)
03:07 camelia rakudo-moar d4a6b92f3: OUTPUT: «False␤»
03:08 lookatme m: say (1, 2, 3, ).contains("1, ")
03:08 camelia rakudo-moar d4a6b92f3: OUTPUT: «False␤»
03:09 lookatme m: say (1, 2, 3, ).Str
03:09 camelia rakudo-moar d4a6b92f3: OUTPUT: «1 2 3␤»
03:09 lookatme m: say (1, 2, 3, ).contains("1 2 ")
03:09 camelia rakudo-moar d4a6b92f3: OUTPUT: «True␤»
03:09 Herby_ rookie question: does declaring types for functions and objects typically provide a speedup compared to not declaring them?
03:10 Herby_ sub triple-number(Int $x) {}    versus   triple-number($x) {}
03:16 mcmillhj joined #perl6
03:16 MasterDuke Herby_: right now there's usually not much of a speedup for using high-level types (e.g., Int, Str). however, native types (e.g., int, str) are frequently faster (assuming of course it's correct to use them in the given situation)
03:17 MasterDuke m: my Int $s; for ^1_000_000 { $s += $_ }; say $s; say now - INIT now
03:17 camelia rakudo-moar d4a6b92f3: OUTPUT: «499999500000␤0.8544502␤»
03:18 MasterDuke m: my int $s; for ^1_000_000 -> int $_ { $s += $_ }; say $s; say now - INIT now
03:18 camelia rakudo-moar d4a6b92f3: OUTPUT: «499999500000␤0.5473163␤»
03:18 Herby_ ahh ok
03:19 Herby_ Looking here: https://docs.perl6.org/type.html, I see Int, int, and Str but I don't see str
03:21 MasterDuke that may be deliberate, i don't think str is as different from Str as int is from Int
03:21 Herby_ gotcha
03:28 pharv joined #perl6
03:28 pharv joined #perl6
03:31 Herby_ joined #perl6
03:31 mcmillhj joined #perl6
03:32 pharv_ joined #perl6
03:40 Guest78496 joined #perl6
03:40 Guest78496 joined #perl6
03:44 w_richard_w joined #perl6
03:51 mcmillhj joined #perl6
04:13 Sgeo__ joined #perl6
04:40 mcmillhj joined #perl6
04:47 curan joined #perl6
04:50 xtreak joined #perl6
04:54 MilkmanDan joined #perl6
04:55 mcmillhj joined #perl6
05:06 mcmillhj joined #perl6
05:09 aindilis` joined #perl6
05:10 jmerelo joined #perl6
05:15 aindilis joined #perl6
05:22 wamba joined #perl6
05:23 Kaiepi what's the command to tell someone who's offline something?
05:24 lookatme .tell Kaiepi :(
05:24 yoleaux lookatme: I'll pass your message to Kaiepi.
05:24 lookatme .tell lookatme :)
05:24 yoleaux lookatme: Talking to yourself is the first sign of madness.
05:24 lookatme .
05:25 domidumont joined #perl6
05:25 mcmillhj joined #perl6
05:26 Kaiepi thanks
05:26 yoleaux 05:24Z <lookatme> Kaiepi: :(
05:27 lookatme welcome
05:27 Kaiepi .tell zoffix i refactored rakudobot so i can add the features you want easily. it also does stresstest instead of spectest now. i'll be adding Inline::Perl5 support soon
05:27 yoleaux Kaiepi: I'll pass your message to zoffix.
05:28 jmerelo releasable6: status
05:28 releasable6 jmerelo, Next release will happen when it's ready. 1 blocker. 263 out of 263 commits logged
05:28 releasable6 jmerelo, Details: https://gist.github.com/a029541f1b7ce6125901e7529b71eb1d
05:29 Kaiepi jesus i did not write it well the first time since i ended up cutting its loc in half
05:30 Kaiepi still does the same thing, just i figured out how to work with perl's style of modules and oop better
05:33 domidumont joined #perl6
05:35 espadrine_ joined #perl6
05:39 b2gills joined #perl6
05:40 xtreak joined #perl6
05:41 mcmillhj joined #perl6
05:47 El_Che morning
05:55 mcmillhj joined #perl6
05:56 andrzejku_ joined #perl6
06:04 domidumont joined #perl6
06:25 andrzejku joined #perl6
06:30 mcmillhj joined #perl6
06:31 japanoise joined #perl6
06:32 robertle joined #perl6
06:46 ufobat_ is there a difference between --> and returns for signatures? I wanted to put a function signature in a pod C<...> but that would not work with -->
06:57 jmerelo ufobat_: that should work in Pods. Maybe escaping?
06:58 jmerelo ufobat_: and yes, there are differences between --> and returns https://docs.perl6.org/type/Signature#index-entry---%3E-returns-Constraining_Return_Types
07:00 ufobat_ https://docs.perl6.org/language/functions#Return_Type_Constraints dosn't mention that there is any difference
07:00 mcmillhj joined #perl6
07:01 ufobat_ maybe there should just be once place in the documentation which covers this topic?
07:01 jmerelo ufobat_: Yep, maybe. Main differences is that returns will probably be obsoleted and it does not work with constant values (verbatim from above)
07:02 ufobat_ i am reading through it :)
07:02 jmerelo p6: sub favorite-number returns 42 { say "Whatever"; }; favorite-number;
07:02 camelia rakudo-moar d4a6b92f3: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Malformed trait␤at <tmp>:1␤------> 3sub favorite-number returns7⏏5 42 { say "Whatever"; }; favorite-number␤»
07:02 jmerelo p6: sub favorite-number( --> 42 ) { say "Whatever"; }; favorite-number;
07:02 camelia rakudo-moar d4a6b92f3: OUTPUT: «Whatever␤»
07:03 ufobat_ if --> is the way to go, and the pod documentation doesn't mention how to quote the > in C<...> it might be not possible
07:03 jmerelo ufobat_: but maybe we should say "different and not equivalent" instead of "many" ways.
07:04 ufobat_ ack!
07:05 jmerelo ufobat_: yep, that's the other end of your question. I can't say off the top of my head. Either escaping or equivalent unicode char or quoting should work... But would have to check it out.
07:05 jmerelo ufobat_: maybe ask in StackOverflow? ;-)
07:06 ufobat_ hah!
07:11 mcmillhj joined #perl6
07:13 jmerelo ufobat_: have you tried it? It seems to work, although in a weird way...
07:13 ufobat_ tried what?
07:13 ufobat_ i just wrote the stackoverflow question
07:13 moritz you can use C<< stuff with --> in it >>
07:14 ufobat_ moritz, what about writing a stack overflow answer :p
07:14 jmerelo ufobat_: thanks!
07:15 moritz done
07:15 ufobat_ \o/
07:21 moritz https://stackoverflow.com/questions/49995488/perl6-singatures-in-pod/49995512 for the record
07:22 El_Che ufobat_: I remember a discussion inclusing TimToady. He liked the '-->' (I like the returns)
07:22 wamba joined #perl6
07:22 moritz same here :-)
07:22 moritz but --> has some advantages (like, it's obviously part of the signature)
07:22 moritz also, people seem to downvote https://stackoverflow.com/a/49892419/14132 and I have no idea why
07:22 ufobat_ is "is export" part of the signature, technically?
07:23 El_Che there was an advantage I forgot. It was a really good point.
07:23 moritz ufobat_: no
07:23 moritz El_Che: the other is about scoping
07:23 moritz ($x, $y --> returns $x * $y) { # side effect here }
07:23 moritz argl
07:23 moritz ($x, $y --> $x * $y) { # side effect here }
07:23 moritz (I don't think that's implemented yet)
07:24 * lizmat clickbaits https://p6weekly.wordpress.com/2018/04/23/2018-17-docking-tau-station/
07:24 yoleaux 06:54Z <nine> lizmat: https://github.com/ugexe/zef/issues/241#issuecomment-383823558
07:25 mcmillhj joined #perl6
07:28 moritz lizmat++
07:28 moritz also, more people should play Tau Station. I love it :-)
07:29 darutoko joined #perl6
07:34 moritz ufobat_: if the answer works, please accept it
07:35 ufobat_ how can i accept it?
07:36 moritz there should be a grayed-out checkmark next to the answer, I think
07:36 moritz https://stackoverflow.com/help/someone-answers
07:36 Geth ¦ doc: 4cff3850e4 | (Luca Ferrari)++ | doc/Language/variables.pod6
07:36 Geth ¦ doc: Little improvement to the list assignment regarding my and our.
07:36 Geth ¦ doc:
07:36 Geth ¦ doc: Related to issue #1958
07:36 Geth ¦ doc: review: https://github.com/perl6/doc/commit/4cff3850e4
07:36 synopsebot Link: https://doc.perl6.org/language/variables
07:36 Geth ¦ doc: 16cc56d4a1 | (Luca Ferrari)++ | doc/Language/variables.pod6
07:36 Geth ¦ doc: More on list variables with my and our.
07:36 Geth ¦ doc:
07:36 Geth ¦ doc: See issue #1958
07:36 Geth ¦ doc: review: https://github.com/perl6/doc/commit/16cc56d4a1
07:37 ufobat_ ah, thanks moritz
07:41 mcmillhj joined #perl6
07:42 dakkar joined #perl6
07:49 buggable New CPAN upload: CPAN-Uploader-Tiny-0.0.5.tar.gz by SKAJI http://modules.perl6.org/dist/CPAN::Uploader::Tiny:cpan:SKAJI
07:58 mcmillhj joined #perl6
08:03 Geth ¦ doc: e12f54f39f | (Luca Ferrari)++ | doc/Language/variables.pod6
08:03 Geth ¦ doc: Modify "package scoped" with something that should sounds better.
08:03 Geth ¦ doc:
08:03 Geth ¦ doc: See issue #1958
08:03 Geth ¦ doc: review: https://github.com/perl6/doc/commit/e12f54f39f
08:03 synopsebot Link: https://doc.perl6.org/language/variables
08:03 Geth ¦ doc: 9f6390b851 | (Luca Ferrari)++ | doc/Language/variables.pod6
08:03 Geth ¦ doc: Reword my scope according to our section.
08:03 Geth ¦ doc:
08:03 Geth ¦ doc: See issue #1958
08:03 Geth ¦ doc: review: https://github.com/perl6/doc/commit/9f6390b851
08:13 mcmillhj joined #perl6
08:25 rindolf joined #perl6
08:30 wamba joined #perl6
08:31 mcmillhj joined #perl6
08:33 Geth ¦ doc: 707ee5acff | (JJ Merelo)++ | doc/Language/variables.pod6
08:33 Geth ¦ doc: Solving conflict refs #1958. I think it can be closed
08:33 Geth ¦ doc: review: https://github.com/perl6/doc/commit/707ee5acff
08:33 synopsebot Link: https://doc.perl6.org/language/variables
08:38 xtreak joined #perl6
08:44 pmurias joined #perl6
08:48 mcmillhj joined #perl6
09:01 xtreak joined #perl6
09:07 mcmillhj joined #perl6
09:19 jmerelo Some help with NativeCall? https://stackoverflow.com/questions/49997598/the-rather-unforgiving-nature-of-the-nativecall-interface-in-perl-6
09:24 mcmillhj joined #perl6
09:25 stmuk_ odd question title!
09:25 ufobat_ does is native(Str) make sense?
09:25 ufobat_ isn't the thing between the () the library name?
09:26 ufobat_ i think the title means "wtf - how to troubleshoot this"
09:27 Geth ¦ doc: 8101444030 | (Jonas Kramer)++ | doc/Type/IO.pod6
09:27 Geth ¦ doc: Mention that without arguments slurp uses $*ARGFILES as fallback.
09:27 Geth ¦ doc: review: https://github.com/perl6/doc/commit/8101444030
09:27 synopsebot Link: https://doc.perl6.org/type/IO
09:35 jmerelo ufobat_: That shouldn't be the problem. It's the syntax used for calling native functions that are not in any external library.
09:36 jmerelo stmuk: well, it's rather unforgiving. Make any mistake, dumps core.
09:36 jmerelo I haven't debugged cores since the 90s. Pretty much around the time I started to use Perl.
09:37 jnthn Using NativeCall successfully pretty much means knowing at least something about C programming.
09:38 moritz and C is simply too untyped for most kinds of automated checks
09:38 mcmillhj joined #perl6
09:38 jmerelo jnthn: but it's not too obvious that to get a CPointer you just need to instantiate a CSstruct.
09:38 jnthn It's not actually Rakudo that dumps core, it's the C code you called dumping core because you called it wrong.
09:39 jmerelo jnthn: Yep, I know. Maybe it should be the "Rather unforgiving nature of the C code called from NativeCode", but it didn't have the same ring to it.
09:39 scimon joined #perl6
09:40 jnthn "How to correctly call clock_gettime with NativeCall" would have been even better ;-)
09:41 jmerelo jnthn: https://stackoverflow.com/questions/49997598/how-to-correctly-use-cpointer-and-cstruct-in-nativecall-interface
09:43 jmerelo jnthn: way I see it, the main problem is that I'm using a CPointer instead of a CStruct. But, in fact, clock_gettime uses a pointer to a struct https://linux.die.net/man/3/clock_gettime
09:43 zakharyas joined #perl6
09:44 jnthn jmerelo: A CStruct instance is already implicitly a pointer to a struct though
09:44 jmerelo jnthn: in fact, you are also creating a new instance, which I don't, but it coredumps all the same if I keep using CPointer and I try to instantiate it.
09:45 jmerelo jnthn: OK, I need to document that, then. Then what's the use case for CPointer?
09:45 jnthn CPointer is when you just want an opaque pointer to something
09:45 jnthn But don't have any data stored within it
09:45 jnthn It should probably complain if you declare something with CPointer and it has attributes
09:45 jmerelo jnthn: as in void*
09:45 jmerelo jnthn: a complain by NativeCall would have made it less unforgiving.
09:46 jnthn Yeah, file an issue about that
09:46 jnthn void* - well, maybe, but it's more useful when the C library does all of the memory allocation itself and you don't ever need to look inside of the structure.
09:47 jnthn You just need to receive and pass the pointer
09:51 eliasr joined #perl6
09:52 jmerelo jnthn: done https://github.com/rakudo/rakudo/issues/1767

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo