🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
timotimo you're only asking about this from a performance standpoint? not like deployability / portability or so? 00:00
discord6 <BrightLight> I think I'm just trying to understand what makes some dynamically typed languages simpler to compile to machine code than others - AOT incremental compiler vs JIT and such. I am just trying to learn what I can. 00:03
timotimo doing ahead-of-time compilation of raku code would leave a whole lot of performance on the table due to unknowns like "what exact type will be here" (i.e. not a subtype or something mixed in etc) or "is this variable in a container at this point or not?" 00:04
moar's jit will generate a direct pointer access on an object when attribute access happens, but non-specialized code will only have the name and a suspected slot so it'll still go look at the attribute name table 00:05
00:08 pecastro left 00:11 oneeggeach joined 00:12 oneeggeach left
discord6 <BrightLight> Thank you; 00:14
timotimo you're welcome :) 00:29
00:50 guifa2 left
discord6 <BrightLight> Also, does Raku have nonlocal transfer of control of some form? For example a return-from <some-lexically-determined-block>. (I'm using Discord so code formatting on here is fine - not sure about the irc clients, so forgive me if my code example doesn't show up properly formatted. lisp (defun foo () (let ((a 1)) (flet ((bar () (let ((b 2)) (return-from foo b)))) (bar)))) 00:50
<BrightLight> Here bar returns from an external block (the function foo). 00:52
00:59 guifa2 joined 01:00 dogbert17 left 01:12 aborazmeh left
timotimo the specification specifies the ability to leave named blocks, at the moment we only have "break from a labelled loop" i think? 01:18
discord6 <BrightLight> Ah fair enough; it's a very nice feature to have so I'm glad to hear 01:21
01:27 lucasb left 01:33 molaf left 01:46 molaf joined 02:06 Manifest0 left, Manifest0 joined 02:44 rbt left
discord6 <Highlander> On this topic, do you happen to know how much optimization we currently do when a type is specified by the user? Mixins and such make it a little harder, but I imagine optimistic specialization is possible 02:45
02:45 rbt joined
discord6 <Highlander> I know we specialize on types that tend to show up at runtime, but I haven't heard much about how user-specified types might help early on 02:47
02:48 softmoth left 03:31 pilne left 03:36 molaf left 03:40 kst joined 04:40 statisfiable6 left, sourceable6 left, linkable6 left, evalable6 left, bisectable6 left, tellable6 left, unicodable6 left, quotable6 left, squashable6 left, committable6 left, notable6 left, releasable6 left, shareable6 left, benchable6 left, nativecallable6 left, greppable6 left, bloatable6 left, coverable6 left, reportable6 left, nativecallable6 joined 04:41 quotable6 joined, squashable6 joined, benchable6 joined, linkable6 joined, shareable6 joined, evalable6 joined, notable6 joined 04:42 statisfiable6 joined, bloatable6 joined, sourceable6 joined, committable6 joined, reportable6 joined, greppable6 joined, releasable6 joined 04:43 bisectable6 joined, unicodable6 joined, coverable6 joined, tellable6 joined 04:52 discoD left 05:00 Doc_Holliwood joined 05:07 Redfoxmoon joined 05:09 oodani left, oodani joined 05:10 Demos[m] left, benkolera left, leah2 left, timeless left 05:15 Demos[m] joined, benkolera joined, leah2 joined, timeless joined, sauvin joined, leah2 left 05:18 leah2 joined 05:34 sjm_uk joined 05:38 Redfoxmoon left, Redfoxmoon joined 05:50 aborazmeh joined, aborazmeh left, aborazmeh joined 06:02 farcas1982regreg joined 06:09 AlexDaniel left 06:22 MasterDuke joined 06:31 Doc_Holliwood left 06:32 aborazmeh left 06:38 girafe joined 07:10 rbt left 07:11 rbt joined 07:31 farcas1982regreg left 07:32 xinming left 07:33 xinming joined 07:37 patrickb joined 07:43 sjm_uk left 07:53 stoned75 joined 07:59 xinming left 08:01 xinming joined 08:02 Doc_Holliwood joined 08:28 ufobat joined 08:36 rindolf joined 08:46 Doc_Holliwood left 08:47 pecastro joined, xinming left 08:49 xinming joined 09:03 ensamvarg_ joined, kensanata joined 09:04 ensamvarg_ left, ensamvarg1 joined 09:05 ensamvarg1 left, ensamvarg2 joined 09:10 sena_kun joined, cpan-raku left 09:12 cpan-raku joined, cpan-raku left, cpan-raku joined 09:13 Altai-man_ joined 09:14 [Sno] left 09:15 [Sno] joined 09:16 sena_kun left 09:22 Black_Ribbon left
patrickb I'm trying to call a Windows API function returning an LPWSTR (pointer to utf16 encoded string) using NativeCall. 09:26
I use `returns Str is encoded('utf16') is rw`. Resulting in `Malformed UTF-16; odd number of bytes (1)`. 09:27
When retrieving the thing via CArray the bytes look as I'd expect though (34, 0, 67, 0, ..., 0, 0). 09:28
Can anyone give a hint on how I can make this work?
09:28 xinming left 09:29 xinming joined
lizmat obtain as bytes, then decode ? 09:33
09:38 xinming left 09:39 xinming joined
patrickb How can I decode a List / CArray? It seems I can't make a native function return a Blob... 09:43
09:57 Doc_Holliwood joined
patrickb I managed to make it work. 10:02
paste.scsys.co.uk/588568 <-- I'd still expect this to work with `returns Str is encoded('utf16') is rw`. Is this a bug? Should I create an issue? 10:07
lizmat patrickb: probably 10:12
patrickb Will do! 10:13
lizmat one note: for 0 .. * -> $i, $j { @nat-arr[$i], @nat-arr[$j] }
patrickb Ah, nice!
lizmat is probably better readable, and with the current state of ... definitely faster 10:14
10:16 xinming left 10:17 xinming joined
El_Che hi patrickb , lizmat 10:22
lizmat El_Che o/
patrickb Hi there! 10:23
github.com/rakudo/rakudo/issues/3629 <- Issue created.
lizmat patrickb++
10:24 dogbert17 joined 10:26 kensanata left
patrickb El_Che: Have you seen github.com/Raku/raku.org/pull/146 ? 10:31
10:38 Doc_Holliwood left, MasterDuke left
El_Che Ill have a look now 10:38
10:46 Doc_Holliwood joined 10:47 AlexDaniel joined, MasterDuke joined 10:48 AlexDaniel left, AlexDaniel joined 10:56 patrickb left 10:57 Maylay left 10:58 Maylay joined 11:02 xinming left 11:03 xinming joined 11:10 molaf joined 11:13 Xliff joined
Xliff \o 11:13
Would a Buf work in place of a CArray[uint8] in all NativeCall instances (both as a parameter type and as a return type)? 11:14
It would seem like a natural thing for them to be, but a while ago, I ran in to segfaults whenever I did it and just wanted to know if that was a bug that had been addressed. 11:15
11:15 sena_kun joined
Xliff m: use NativeCall; sub malloc(uint64) returns Buf; my $a = malloc(100); say $a; 11:15
camelia 5===SORRY!5=== Error while compiling <tmp>
A unit-scoped sub definition is not allowed except on a MAIN sub;
Please use the block form. If you did not mean to declare a unit-scoped sub,
perhaps you accidentally placed a semicolon after routi…
Xliff m: use NativeCall; sub malloc(uint64) is native returns Buf; my $a = malloc(100); say $a;
camelia 5===SORRY!5=== Error while compiling <tmp>
A unit-scoped sub definition is not allowed except on a MAIN sub;
Please use the block form. If you did not mean to declare a unit-scoped sub,
perhaps you accidentally placed a semicolon after routi…
Xliff m: use NativeCall; sub malloc(uint64) is native returns Buf { * }; my $a = malloc(100); say $a; 11:16
m: 2 + 2
Eep! Did I just kill camelia?
11:17 Altai-man_ left 11:19 camelia left
lizmat Xliff: possibly :-) 11:22
nine: ^^
11:24 rindolf left 11:26 camelia joined 11:34 [Sno] left 11:36 [Sno] joined
nine m: say "back" 11:37
camelia back
11:39 Doc_Holliwood left 11:47 xelxebar left, xelxebar joined 11:49 rindolf joined, xinming left 11:51 xinming joined 12:04 [Sno] left 12:06 [Sno] joined 12:09 xinming left, xinming joined 12:10 rbt left 12:11 rbt joined, aborazmeh joined, aborazmeh left, aborazmeh joined 12:27 Xliff left 12:35 cognominal joined 12:38 cognomin_ left 12:39 Doc_Holliwood joined
Geth_ doc: 45d04e5ea6 | (Jonathan Worthington)++ (committed using GitHub Web editor) | doc/Language/nativecall.pod6
Mention native callback exception handling

The error reporting from MoarVM about this situation recently improved. This adds a mention about it to the documentation also.
linkable6 Link: docs.raku.org/language/nativecall
12:51 pilne joined 13:05 clarkema joined 13:06 aborazmeh left 13:14 Doc_Holliwood left, Altai-man_ joined 13:17 sena_kun left 13:27 lichtkind joined 13:34 veesh_ joined 13:35 veesh left 13:36 veesh_ is now known as veesh
lichtkind in june 2019 was a perl 6 user survey 13:37
does anybody has the link?
Altai-man_ docs.google.com/forms/d/1WQpY740a8...#responses lichtkind 13:39
tellable6 2020-04-16T22:10:28Z #raku-dev <AlexDaniel> Altai-man_: github.com/ugexe/zef/issues/342
2020-04-16T22:12:10Z #raku-dev <AlexDaniel> Altai-man_: I don't know if it's the only issue, but at least it's something I was able to reproduce on my own setup
lichtkind Altai-man ++ thanks i got jsut the previous one in 2019
ähm 2018 13:40
Altai-man++ 13:41
13:42 xfix left 13:43 xfix joined 13:54 xinming left, Redfoxmoon left, Redfoxmoon joined 13:56 xinming joined 14:02 greppable6 left 14:12 xinming left, xinming joined 14:19 aborazmeh joined, aborazmeh left, aborazmeh joined 14:26 xinming left 14:28 xinming joined 14:33 greppable6 joined 14:41 Doc_Holliwood joined 15:14 molaf left 15:15 sena_kun joined 15:16 Altai-man_ left 15:25 ufobat_ joined 15:29 ufobat left 15:31 Redfoxmoon left, Redfoxmoon joined 15:33 ensamvarg2 left 15:36 mowcat joined 15:38 Doc_Holliwood left, lichtkind left 15:42 veesh left 15:45 guifa2 left 15:55 guifa2 joined, veesh joined 15:57 aborazmeh left 16:00 [Sno] left 16:06 xfix left 16:30 kst left 16:31 kst` joined, samebchase left, samebchase joined
guifa2 jnthn++ and (iirc) sena_kun++ for Comma release 16:37
sena_kun \o/ 16:38
guifa2 And congrats for figuring out mac code signing! 16:40
guifa2 knows it's a pain in the ass
16:45 chloekek joined
lizmat we haz a Comma release ? 16:45
16:45 sjm_uk joined
jnthn A couple of weeks ago, but I guess some are only just getting around to trying it :) 16:46
There's one every month for subscribers
Later this month there'll be a new community one also :)
lizmat and you didn't tweet about it ?
16:46 cognomin_ joined
lizmat last thing I saw was twitter.com/jnthnwrthngtn/status/1...0065078275 16:46
jnthn Pretty sure I tweeted about the headline new feature that was coming in it :)
Yes, that one :) 16:47
lizmat yeah, but because there was no formal announcement, I assumed the release was held up on account of signing issues
16:47 [Sno] joined
lizmat and thus wasn't mentioned in the RWN 16:48
guifa2 jnthn: I only got the message for 2020.03 today 16:49
guifa2 just realized in typing that that 2020.03 means "came out two weeks ago..."
It kinda feels like we're still in March =\
jnthn It checks at every startup for updates, unless you disable that (or have no internets...)
16:50 cognominal left 16:52 veesh left
guifa2 Is it possible to reference random Raku grammar tokens inside of an adhoc regex/grammar? 16:55
guifa2 is currently testing with just <identifier> to be replaced later, but it would be sweet if it's easy to reference the real one
sena_kun <Grammar::rule-i-want> ? 16:56
lizmat m: say "24 foobar 99" ~~ / <ident> /
camelia 「foobar」
ident => 「foobar」
guifa2 sweet 16:57
16:58 stoned75 left
guifa2 sena_kun: gives a P6opaque error on that one 16:58
sena_kun guifa2, it was a worthy fight to try it out... :] 16:59
17:00 molaf joined
guifa2 I've just got about got an initial test of Binex. Not a pretty interface ATM but functional. Mainly missing the operators and still thinking through some other usability questions 17:01
17:06 veesh joined 17:10 rbt left 17:11 rbt joined, xinming left
timotimo guifa2: i think in the binary regex document there's a /foo/modifiers somewhere, where the modifiers ought to go at the start 17:11
guifa2 timotimo: lemme check it. As I'm writing it I'm catching little errors I had 17:12
17:13 xinming joined
timotimo *thumbs up* 17:13
17:14 Altai-man_ joined
guifa2 bgills' suggestion for Z and X are creating an interesting question 17:15
17:17 sena_kun left
guifa2 It's possible for the same token to have two different values, an issue that doesn't exist in regex (where <foo> & <bar> must match identical text, and thus their capture values would be exactly the same) 17:18
err, rephrased, <foo> could be matching one value, but needing to return another, and <bar> would still be matching the same, but needing to return a different one. So <abc> if coerced to a blob, should it return to the original matched data, or give preference to foo/bar's modified values? 17:20
17:45 kst joined 17:58 sjm_uk left 18:05 lichtkind joined 18:06 mowcat left 18:08 sjm_uk joined 18:19 sauvin left 18:34 finsternis joined 18:47 veesh left 18:49 softmoth joined 18:51 cognominal joined 18:55 cognomin_ left
moritz what do you mean by "return another"? 18:57
18:57 rbt left
moritz that it captures something else? 18:57
18:58 rbt joined
moritz a regex either matches or it doesn't, and it advances the cursor in the string zero or more characters 18:58
19:00 kst` left, kst left 19:01 veesh joined, kst joined
guifa2 moritz: correct. 19:01
bgills had a nice suggestion for binex syntax to allow for, e.g., b11.._XXXX, which would match any byte with the highest two bits on, but would then right-shift the value, so that 0b1101_1101 ~~ bin/b11.._XXXX/ would net you 0b0000_1101
19:02 Black_Ribbon joined
moritz currently, $/ indexes into the originally matched string 19:03
but you could always attach the modified value to $/.ast
guifa2 Yeah, that's one of the solutions I'm thinking about 19:04
19:04 softmoth left, softmoth joined
moritz I haven't read the proposal yet, so don't know the context exactly, but returning some that isn't quite Match but has a similar API might also be possible 19:05
guifa2 moritz: it's a super early proposal, so please feel free when you do read it to shred it to pieces :-) 19:06
Right now I'm thinking a trait (or separator declarator) might be a good way to go about it. "token is scoured { ... }" where the is-scoured trait would allow the use of X and Z (opting into the modifications, and allowing them to trickle up if desired), and disallowing &/&& because it creates an ambiguous modification value 19:07
19:09 xinming left, xinming joined 19:12 cognominal left 19:15 sena_kun joined 19:17 Altai-man_ left 19:20 xinming left 19:22 xinming joined 19:25 kenshiro joined
jdv79 i just ran raku -e 'sleep' and perl -e 'sleep' and noticed raku uses 80M and perl uses 4M. is raku expected to always use way more mem? 19:27
19:27 softmoth left 19:28 softmoth joined
jdv79 i have an app where a deliberately scaled down version takes 400M and now i'm curious if i'll be able to run the full intended version 19:29
19:31 pierrot left 19:35 pierrot joined 19:36 dogbert17 left 19:38 Xliff joined
Xliff can repr CPointers compose a DESTROY? 19:39
m: use NativeCall; class A is repr<CPointer> { submethod DESTROY { say "Hi!" }; }; A.new.say;
camelia A.new
Xliff m: use NativeCall; class A is repr<CPointer> { submethod DESTROY { say "Hi!" }; }; my $a = A.new; $a = Nil; sleep 5; 19:40
camelia ( no output )
Xliff Aand... GC was never run.
19:44 kenshiro left 19:49 k-man__ joined
Xliff m: use NativeCall; class A is repr<CPointer> { submethod DESTROY { say "Hi!" }; }; { my $a = A.new; $a = Nil; }; sleep 5; 19:50
camelia ( no output )
19:50 k-man_ left
Xliff m: use NativeCall; class A is repr<CPointer> { submethod DESTROY { say "Hi!" }; }; { my $a = A.new; $a.^METHODS.say }; sleep 5; 19:50
camelia Hi!
No such method 'METHODS' for invocant of type 'Perl6::Metamodel::ClassHOW'
in block <unit> at <tmp> line 1
Xliff m: use NativeCall; class A is repr<CPointer> { submethod DESTROY { say "Hi!" }; }; { my $a = A.new; $a.^methods.say }; sleep 5;
Xliff m: use NativeCall; class A is repr<CPointer> { submethod DESTROY { say "Hi!" }; }; { my $a = A.new; A.^methods.say }; sleep 10; 19:51
Xliff How can I force call the GC?
m: use NativeCall; use nqp; class A is repr<CPointer> { submethod DESTROY { say "Hi!" }; }; { my $a = A.new; A.^methods.say }; nqp::force_gc(); sleep 10; 19:52
guifa2 jdv79: on my system, perl -e 'sleep' uses 628k, but perl -e 'use Moose; sleep' uses 15M 19:56
Raku is more akin to perl+Moose (or perl+other OO package) than perl by itself. That said, raku -e 'sleep' on mine uses 50 MB, so there's a bit more stuff there for sure. 20:05
20:13 molaf left 20:26 pmurias joined, sjm_uk left 20:37 rindolf left, gdonald left 20:39 Doc_Holliwood joined
Doc_Holliwood why do we have sigilless variables? 20:39
what's their intended purpose?
20:42 gdonald joined 20:46 aborazmeh joined, aborazmeh left, aborazmeh joined
jnthn Not enforcing context 20:51
guifa2 just looked up the design docs, and apparently the current sigilless vars were going to be sigiled, just with ¢ 20:54
jnthn Hah, I'd forgotten that bit of history :) 21:07
21:10 xinming left, xinming joined 21:14 Altai-man_ joined 21:17 sena_kun left
guifa2 jnthn: that also reminds me of a long ago project I had concocted: creating custom sigils. I think after digging around in Rakudo enough I might even be able to pull it off 21:23
I decided to not reinvent the wheel on Binex and I'm shamelessly ste--borrowing the built in regex grammar and actions and just deleting / adding what's necessary 21:24
But learning a lot about the internals along the way
21:28 xelxebar left 21:29 xelxebar joined 21:32 mowcat joined 21:39 softmoth left
Xliff m: class A { }; role B { }; my \a = A,new but B; a.^name.say 21:45
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of C++ constructor syntax; in Raku please use method call syntax
at <tmp>:1
------> 3ss A { }; role B { }; my \a = A,new but 7⏏5B; a.^name.say
Xliff m: class A { }; role B { }; my \a = A.new but B; a.^name.say
camelia A+{B}
Xliff Huh! 21:46
I thought sigilless was equiv to "is raw" and that those were containerless.
lizmat Xliff: sigilless means binding 21:48
but if you bind a container...
m: my \x = $ = 42; dd x; x = 666; dd x
camelia Int $ = 42
Int $ = 666
21:49 pmurias left
Xliff lizmat: Yes, if you bind to a container you get the container, but if you don't is there a need to cont/decont? 21:50
lizmat indeed
Xliff Is that a yes or a no?
21:51 molaf joined
lizmat yes 21:51
that's why hot code can benefit from binding rather than assigning containers
Xliff Ah! So what's the best way to avoid the cont/decont penalty?
Now I'm confused. :/
lizmat see e.g 2d1ba433af8c730126e7 21:52
linkable6 (2020-04-14) github.com/rakudo/rakudo/commit/2d1ba433af Make Num.Rat conversion again 1.5x as fast
lizmat the original code used $a,$b,$c,$d etc with containers 21:53
by using binding, that saved 7 scalar allocations for each conversion
of num to Rat 21:54
m: my $a = 42; for ^1000000 { my $b = $a + 666 }; say now - INIT now 22:00
camelia 0.0945552
lizmat m: my $a = 42; for ^1000000 { my $b := $a + 666 }; say now - INIT now
camelia 0.03908242
lizmat m: my $a := 42; for ^1000000 { my $b := $a + 666 }; say now - INIT now
camelia 0.021793
22:03 cpan-raku left 22:06 cpan-raku joined, cpan-raku left, cpan-raku joined
Xliff So sigilless/bind does not need cont/decont. 22:07
22:10 rbt left 22:11 rbt joined
cpan-raku New module released to CPAN! BitEnum (0.3) by 03CTILMES 22:15
chloekek … I just realized why it’s called kebab case. 22:33
tellable6 2020-04-17T11:21:06Z #raku-dev <lizmat> chloekek: wonder how that applies to CRAI ?
2020-04-17T11:21:36Z #raku-dev <lizmat> chloekek: that being en.wikipedia.org/wiki/BagIt
chloekek The letters are skewered along a centered stick. 22:34
I never noticed because where I live kebab usually refers to döner kebab, which is not served skewered. 22:35
lizmat: > A required tag file contains a manifest listing every file in the payload together with its corresponding checksum. — Sounds like my CRAI’s database. 22:36
s/my CRAI’s/CRAI’s SQLite/. 22:37
jnthn lizmat: Be a little careful with that assign vs. bind benchmark showing a 3x difference; in the binding case, assuming the lexical is lowered, then I think spesh can reason that the addition as dead code, so it's probably not actually measuring what you hope :)
22:37 Doc_Holliwood left 22:43 chloekek left
jnthn lizmat: Yes, checked and indeed, the integer add totally vanishes in the bind case too. 22:48
22:49 pilne left
jnthn In the binding case it can't yet toss that out because binding an attribute (the $!value of Scalar) is an effect 22:49
Sorry, s/binding/assignment/ in that one
However, EA would probably nail that one 22:50
.oO( All this optimization effort, just to screw up people's benchmarks... )
22:54 melezhik joined 23:04 aborazmeh left 23:05 pilne joined 23:08 melezhik left 23:15 sena_kun joined 23:17 Altai-man_ left 23:19 softmoth joined 23:35 mowcat left 23:40 guifa2 left 23:47 xinming left 23:49 cpage left, cpage joined, xinming joined 23:51 pecastro left 23:54 lichtkind left 23:55 wildtrees joined 23:58 clarkema left