🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:00 reportable6 left 00:02 reportable6 joined 00:04 rf_ joined 00:27 rf left, rf_ left 00:37 rf joined, rf_ joined 00:59 rf_ left 01:04 xinming left 01:06 xinming joined 01:38 derpydoo joined 01:46 jgaz left 02:15 teatime left 02:16 teatime joined 02:20 teatime left 02:21 teatime joined 02:24 teatwo joined 02:26 teatwo left, teatwo joined, rf left 02:27 teatime left 02:43 derpydoo left 03:43 linkable6 left, bloatable6 left, squashable6 left, nativecallable6 left, evalable6 left, greppable6 left, releasable6 left, reportable6 left, tellable6 left, coverable6 left, unicodable6 left, shareable6 left, quotable6 left, sourceable6 left, statisfiable6 left, notable6 left, committable6 left, reportable6 joined, greppable6 joined 03:44 notable6 joined, quotable6 joined, unicodable6 joined, coverable6 joined, statisfiable6 joined, committable6 joined 03:45 tellable6 joined, squashable6 joined, nativecallable6 joined, bloatable6 joined, evalable6 joined, releasable6 joined 03:46 sourceable6 joined, shareable6 joined, linkable6 joined 04:01 zara joined 04:23 zara left 04:42 jpn joined 04:46 jpn left 05:40 jetchisel left 05:42 jetchisel joined 05:55 euandreh left, euandreh joined 06:00 reportable6 left 06:02 reportable6 joined 06:09 euandreh left 07:09 bloatable6 left, linkable6 left, coverable6 left, tellable6 left, evalable6 left, committable6 left, statisfiable6 left, sourceable6 left, squashable6 left, nativecallable6 left, unicodable6 left, reportable6 left, greppable6 left, shareable6 left, notable6 left, quotable6 left, releasable6 left, benchable6 left, notable6 joined, sourceable6 joined, reportable6 joined, committable6 joined 07:10 statisfiable6 joined, squashable6 joined, evalable6 joined, unicodable6 joined, greppable6 joined, nativecallable6 joined 07:11 bloatable6 joined, linkable6 joined, tellable6 joined, coverable6 joined, releasable6 joined 07:12 quotable6 joined, shareable6 joined, benchable6 joined 07:21 kjp left 07:24 kjp joined 07:52 sena_kun joined 07:57 Sgeo left 08:02 Manifest0 joined 08:08 dakkar joined 08:17 abraxxa joined 08:34 Vyrus left 08:47 ab5tract left 09:39 abraxxa left 09:41 abraxxa joined 10:05 xinming left 10:07 xinming joined 11:07 bloatable6 left, quotable6 left, greppable6 left, unicodable6 left, committable6 left, notable6 left, squashable6 left, coverable6 left, reportable6 left, sourceable6 left, statisfiable6 left, nativecallable6 left, benchable6 left, tellable6 left, releasable6 left, evalable6 left, shareable6 left, linkable6 left, bisectable6 left 11:08 statisfiable6 joined 11:09 reportable6 joined, squashable6 joined, bisectable6 joined, quotable6 joined, shareable6 joined, Vyrus joined, nativecallable6 joined, coverable6 joined 11:10 notable6 joined, greppable6 joined, linkable6 joined, releasable6 joined, tellable6 joined, evalable6 joined, unicodable6 joined, sourceable6 joined, committable6 joined, bloatable6 joined 11:11 benchable6 joined
lizmat clickbaits rakudoweekly.blog/2023/04/24/2023-...aseperiod/ 11:46
12:00 reportable6 left 12:02 reportable6 joined 12:14 TieUpYourCamel joined 12:17 euandreh joined 12:19 rypervenche left 12:25 rypervenche joined 12:39 euandreh left 13:27 jgaz joined, euandreh joined 13:28 rf joined 13:31 euandreh left 13:32 euandreh joined 13:41 eroux joined 13:58 rf left 13:59 rf joined
Anton Antonov @lizmat Thanks. 14:01
14:18 tea3po joined 14:22 teatwo left 14:23 jgaz left 14:24 jgaz joined, squashable6 left 14:27 squashable6 joined 14:29 Sgeo joined 14:47 abraxxa left 14:48 lucs left 14:49 lucs joined 15:00 jpn joined 15:20 jpn left 15:23 jpn joined 15:42 Oshawott left 15:43 Oshawott joined 16:00 jpn left 16:06 jpn joined 16:23 synthmeat left 16:26 Xliff joined 16:30 synthmeat joined
Xliff Hi. How can I turn a Callable into a function pointer so I can have C run my Raku routines via NativeCall? 16:33
m: use NativeCall; sub a { 1 }; my $b = nativecast(Pointer, &a); say $b
camelia Native call cast expected return type with CPointer, CStruct, CArray, or VMArray representation, but got a P6opaque (Sub)
in sub nativecast at /home/camelia/rakudo-m-inst-2/share/perl6/core/sources/DEC5BE9BC483C8510E136763F98614A8853D2A40 (NativeC…
Xliff That used to work.
I think.
16:35 dakkar left
Xliff m: use NativeCall; sub set_func_pointer( \func, &sprint) { my $bug = buf8.allocate(20); my $len = &sprint($buf, '%lldf', func); Pointer.new( $buf.subbuf(^$len).decode.Int ); }; sub a { 1 }; say set_func_pointer(&a, &sprintf) 16:39
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$buf' is not declared. Did you mean any of these: 'Buf',
'$bug'?
at <tmp>:1
------> = buf8.allocate(20); my $len = &sprint(⏏$buf, '%lldf', func); Pointer.new( $buf.
Xliff m: use NativeCall; sub set_func_pointer( \func, &sprint) { my $buf = buf8.allocate(20); my $len = &sprint($buf, '%lldf', func); Pointer.new( $buf.subbuf(^$len).decode.Int ); }; sub a { 1 }; say set_func_pointer(&a, &sprintf)
camelia Cannot resolve caller sprintf(Buf[uint8]:D, Str:D, Sub:D); none of these signatures matches:
(Str(Cool) $format, *@args)
in sub set_func_pointer at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff I had some old code do to it but was hoping things had simplified since then. 16:40
m: use NativeCall; sub set_func_pointer( \func, &sprint) { my $buf = buf8.allocate(20); my $len = &sprint($buf, '%lldf', func); Pointer.new( $buf.subbuf(^$len).decode.Int ); }; sub a { 1 }; sub sprintf-v (Blob, Str, &() ) returns int64 is native is symbol('sprintf'); say set_func_pointer(&a, &sprintf-v) 16:42
camelia ===SORRY!=== Error while compiling <tmp>
Shape declaration with () is reserved;
please use whitespace if you meant a subsignature for unpacking,
or use the :() form if you meant to add signature info to the function's type
at <tmp>:1…
Xliff m: use NativeCall; sub set_func_pointer( \func, &sprint) { my $buf = buf8.allocate(20); my $len = &sprint($buf, '%lldf', func); Pointer.new( $buf.subbuf(^$len).decode.Int ); }; sub a { 1 }; sub sprintf-v(Blob, Str, &() ) returns int64 is native is symbol('sprintf'); say set_func_pointer(&a, &sprintf-v)
camelia ===SORRY!=== Error while compiling <tmp>
Shape declaration with () is reserved;
please use whitespace if you meant a subsignature for unpacking,
or use the :() form if you meant to add signature info to the function's type
at <tmp>:1…
Xliff m: use NativeCall; sub set_func_pointer( \func, &sprint) { my $buf = buf8.allocate(20); my $len = &sprint($buf, '%lldf', func); Pointer.new( $buf.subbuf(^$len).decode.Int ); }; sub a { 1 }; sub sprintf-v(Blob, Str, & () ) returns int64 is native is symbol('sprintf'); say set_func_pointer(&a, &sprintf-v)
camelia ===SORRY!=== 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 I have to do this: 16:49
m: use NativeCall; sub sprintf-v(Blob, Str, & () ) returns int64 is native is symbol('sprintf') { * }; sub set_func_pointer( \func, &sprint) { my $buf = buf8.allocate(20); my $len = &sprint($buf, '%lld', func); $buf.say; my $b =$buf.subbuf(^$len).decode.Int; say $b; Pointer.new($b) }; sub a { 1 }; say set_func_pointer(&a, &sprintf-v)
camelia Buf[uint8]:0x<31 34 30 33 33 30 33 34 30 39 37 30 34 39 36 00 00 00 00 00>
140330340970496
NativeCall::Types::Pointer<0x7fa1341ff000>
16:49 synthmeat left
Xliff Because Rakudo doesn't nativecast a Callable to a pointer... 16:49
Is there a better way?
16:50 synthmeat joined 16:57 synthmeat left 17:07 synthmeat joined 17:22 jpn left
sjn Heya; Is there a "latinize" method in Raku (e.g. one that will translate a Cyrillic Р to R)? 17:29
rf I think you can change encoding of a string if that's what you're after
lizmat sjn: not to my knowledge. Would it be more than just a .trans ? 17:36
17:59 bigdata joined 18:00 reportable6 left 18:02 reportable6 joined 18:18 jpn joined 18:23 jpn left 18:27 abraxxa joined 18:59 jpn joined 19:28 jpn left 19:58 rf left 20:08 abraxxa left 20:48 sena_kun left
Xliff How can I check if a routine was marked with "is rw" trait? 20:53
m: class A { method a is rw { 1 } }; .say for my $m = A.^lookup("a"); $m.^attributes[2].get_value($m).say 20:58
camelia a
1
Xliff Gotta be a better way than that... :( 20:59
Nemokosch there is an rw method on Methods 21:11
21:48 linkable6 left, evalable6 left 21:50 evalable6 joined, linkable6 joined
gfldex m: class A { method m is rw { } }; A.^lookup('m').rw.say; 22:03
camelia True
gfldex Xliff: ^^^
m: class A { multi method m is rw { } }; A.^can('m')».rw.say; 22:05
camelia (False)
gfldex No idea why that doesn't work for multies.
Nemokosch the metadata probably needs to belong to the proto; multi dispatch candidates are kinda fakers 22:12
lizmat m: class A { multi method m is rw { } }; A.^find_method("m").candidates.head.rw.say 22:23
camelia True
lizmat m: class A { multi method m { } }; A.^find_method("m").candidates.head.rw.say
camelia False
22:50 evalable6 left, linkable6 left 22:51 evalable6 joined 22:52 linkable6 joined
Xliff gfldex++ lizmat++ 23:04
23:06 Xliff left
uzl[m] lizmat++ gfldex++ 23:14
23:22 Manifest0 left 23:38 jgaz left