[00:00] *** stoned75 joined [00:06] .tell tony-o please take a look at this - https://github.com/tony-o/raku-fez/pull/15 , thanks [00:06] melezhik, I'll pass your message to tony-o [00:11] *** lucasb left [00:12] *** benjif left [00:12] using JSON::Fast, the to-json function is particurly slow (even with :!pretty). [00:13] Is there a alternative to manage large JSON files? [00:14] notagoodidea: wrt libclang, not writing a native c parser with a raku grammar seems like a missed opportunity [00:15] (though maybe that needs more perf work yet; as I recall, somebody was trying to express a c++ grammar in raku and it took several minutes to parse a simple function declaration) [00:15] And following the various #include to parse too can be hell. [00:16] I will first try to port this https://github.com/floooh/sokol/tree/bindgen/bindgen to Raku [00:16] notagoodidea: There is JsonC... but if I recall comments about it, perf still leaves a little to be desired [00:17] From json spit by clang, filtering it and producing NativeCall from the cleaned json like floooh did for zyg. [00:17] yeah preprocessor is a pain [00:17] the parsing is faster, but the conversion from C to Raku data structure is a tad slow [00:17] notagoodidea: but, in raku you can already modify the parser over the course of a running program. Idk how that works but presumably you could do the c preprocessor in the same way [00:17] Will see because to-json is running on my computer for the last 10 minutes :) [00:18] (the JSON provided is big) [00:19] notagoodidea: afaik the sokol bindgen stuff relies on specific annotations in the sokol headers. So you wouldn't be able to use it for any other library [00:19] 165302 lines. [00:21] ah. [00:22] will try at least for the simplified json output from the clang dump. [00:26] moon-child: Leveraging grammer will be nice but I am not sure that will happen soon, performance wise. [00:26] I am not sure that even parsing JSON with grammar will be that performand (JSON::Fast goes straight for nqp) [00:27] :/ [00:28] And it will be a pain to use because it convert the JSON to a Str :/ [00:29] JsonC converts to a hash, that would be easier. [00:30] .tell tony-o I've added integration test for `fez meta` [00:30] melezhik, I'll pass your message to tony-o [00:30] http://161.35.142.50/report/fez-test/276 [00:31] .tell tony-o maybe I should push all the tests to fez repo? i don't know ... [00:31] melezhik, I'll pass your message to tony-o [00:32] Forget it, JsonC does not pass his test and zef refuse to install :/ [00:32] *** stoned75 left [00:41] *** benjif joined [00:46] *** pecastro left [00:53] *** oddp left [00:56] *** notagoodidea left [01:06] *** stoned75 joined [01:20] *** squashable6 left [01:21] *** jmchael left [01:23] *** squashable6 joined [01:35] *** mowcat left [01:41] *** melezhik left [01:42] *** stoned75 left [02:19] *** Ben_Goldberg joined [02:19] *** BenGoldberg left [02:20] *** Ben_Goldberg is now known as BenGoldberg [02:41] *** kvw_5 joined [02:45] *** kvw_5_ left [03:05] *** Sgeo_ joined [03:08] *** Sgeo left [03:22] *** benjif left [03:25] *** melezhik joined [03:25] . [03:26] .tell tony-o I put fez-test sparky configuration - https://github.com/melezhik/sparky-playground/tree/main/fez-test so far ... cc tib [03:26] melezhik, I'll pass your message to tony-o [03:41] *** melezhik left [04:41] *** sourceable6 left [04:41] *** greppable6 left [04:41] *** evalable6 left [04:41] *** unicodable6 left [04:41] *** committable6 left [04:41] *** bloatable6 left [04:41] *** linkable6 left [04:41] *** coverable6 left [04:41] *** benchable6 left [04:41] *** squashable6 left [04:41] *** nativecallable6 left [04:41] *** tellable6 left [04:41] *** bisectable6 left [04:41] *** shareable6 left [04:41] *** statisfiable6 left [04:41] *** quotable6 left [04:41] *** notable6 left [04:41] *** releasable6 left [04:41] *** sourceable6 joined [04:42] *** greppable6 joined [04:42] *** nativecallable6 joined [04:42] *** statisfiable6 joined [04:42] *** bloatable6 joined [04:42] *** quotable6 joined [04:42] *** evalable6 joined [04:42] *** unicodable6 joined [04:42] *** tellable6 joined [04:42] *** benchable6 joined [04:43] *** shareable6 joined [04:43] *** coverable6 joined [04:43] *** committable6 joined [04:43] *** notable6 joined [04:44] *** linkable6 joined [04:44] *** releasable6 joined [04:44] *** squashable6 joined [04:44] *** bisectable6 joined [05:19] *** BenGoldberg left [05:26] *** hippo_ joined [05:26] *** epony left [05:27] *** epony joined [05:31] Just saw about raku.land [05:31] Nice [05:31] Not sure why they're called "distributions" though. [05:32] Not "modules"? [05:37] *** brtastic joined [05:54] *** kst joined [05:54] *** kst left [05:55] *** kst joined [06:02] *** melezhik joined [06:04] lucs not a big difference on my view.  distribution is a certain version of a module ... something ... [06:05] I really like this page - https://raku.land/recent - a kind a trend of what's going on ... [06:08] *** melezhik left [06:11] *** jmerelo joined [06:12] jmerelo: Good morning. [06:13] Having fun in the snow? [06:14] melezhik: Yeah, makes sense. Just not used to that term I guess. [06:14] lucs, I'll pass your message to melezhik [06:30] lucs: not down here, in Granada... [06:31] Not too far away, anyway. [06:33] Aw, too bad, snow is nice (sometimes) ;) [06:33] *** rindolf joined [06:33] Actually, I didn [06:34] 't read up much on what happened. [06:34] I guess it must be pretty hard when you're not prepared for it. [06:35] *** wamba joined [06:42] *** parabolize left [06:44] *** jmcgnh joined [06:55] *** aluaces joined [06:58] lucs: it's nice if you're warm and chill... I'm telecommuting these days, so... [07:01] jmerelo: I grew up playing in the snow (winters, that is), which was nice. [07:01] As an adult, not so much :) [07:01] Warm++ [07:02] lucs: not so usual where I lived. Just the cold and the chilblains. Even in Granada, it's an once every five years event. [07:03] not so usual in Madrid, either. Some people are having the time of their lives. Some are just having the most miserable time of their lives. [07:03] I lived in Úbeda, north of Granada, a small town which is 700 meters high. But Jaén and Granada are too dry, so rain is unusual [07:03] m: multi sub trait_mod: (Method $m, :$query!) { my $r = $m; $m.wrap(-> |c { say 'Hi!'; nextsame; }); }; class A::B { method b is query { say 'B'; }; }; [07:03] rakudo-moar d53a92733: ( no output ) [07:03] lucs: where did you live? [07:04] m: multi sub trait_mod: (Method $m, :$query!) { my $r = $m; $m.wrap(-> |c { say 'Hi!'; nextsame; }); }; class A::B { method b is query { say 'B'; }; }; A::B.new.b [07:04] rakudo-moar d53a92733: OUTPUT: «Hi!␤Attempt to return outside of immediately-enclosing Routine (i.e. `return` execution is outside the dynamic scope of the Routine where `return` was used)␤ in block at line 1␤ in block at line 1␤␤B␤» [07:04] jmerelo: In Montréal [07:04] m: multi sub trait_mod: (Method $m, :$query!) { my $r = $m; $m.wrap(method (|c) { say 'Hi!'; nextsame; }); }; class A::B { method b is query { say 'B'; }; }; A::B.new.b [07:04] rakudo-moar d53a92733: OUTPUT: «Hi!␤B␤» [07:04] (Still there) [07:04] Wow. That doesn't work on my version of Raku. [07:04] m: $*PERL.compiler.version.say [07:04] rakudo-moar d53a92733: OUTPUT: «v2020.12.42.gd.53.a.92733␤» [07:05] lucs: makes sense, then. [07:06] Xliff: what didn't work? [07:10] m: multi sub trait_mod: (Method $m, :$query!) { my $r = $m; $m.wrap(method (|c) { say 'Hi!'; nextsame; }); }; class A::B { method b is query { say 'B'; }; }; A::B.new.b [07:10] rakudo-moar d53a92733: OUTPUT: «Hi!␤B␤» [07:10] ^^ [07:10] I get a 'Cannot invoke this object' error, locally. [07:11] I'm on the same version as Camelia. [07:12] Xliff: from the REPL? [07:12] rak? [07:12] What REPL? [07:12] No, I'm running that from the command line. [07:13] I thought I had found a bug, and now it's looking to be environmental. Which is .... ODD [07:13] Xliff: Ah, OK. The REPL might behave in a different way. Maybe it's just a new goodie in HEAD [07:13] Xliff: give committable a try [07:13] No. It's not a problem here. [07:13] I was hoping I could replicate it HERE. [07:14] I cannot. [07:14] It even works on repl.it [07:20] *** aborazmeh joined [07:20] *** aborazmeh left [07:20] *** aborazmeh joined [07:24] *** sjm_uk joined [07:24] jmerelo: FINALLY! [07:24] See https://repl.it/@Xliff/SorrowfulFlawedMicrobsd#main.raku [07:25] The compunit is the problem. Somehow the compunit is corrupting things. What I'm attempting works just fine when it's in MAIN:: [07:25] And with that, I must crash and ZZZZZ [07:27] *** ufobat__ joined [07:29] Xliff: have a good night sleep :-) [07:32] tanks! ;) [07:32] *** Xliff left [07:40] *** aborazmeh left [07:40] *** aluaces left [07:59] *** sena_kun joined [08:05] *** domidumont joined [08:09] *** MasterDuke joined [08:10] *** BenGoldberg joined [08:10] *** aluaces joined [08:14] *** stoned75 joined [08:16] nef [08:27] *** notagoodidea joined [08:27] *** Manifest0 left [08:30] *** Manifest0 joined [08:33] *** cgfbee left [08:34] *** Sgeo_ left [08:35] *** notagoodidea left [08:38] *** cgfbee joined [08:38] SmokeMachine: is it possible to completely delete the optimizer in Red? [08:39] Not currently, but that’s easy to change... why? Is it giving you problems? [08:41] xinming_: just need to not run this: https://github.com/FCO/Red/blob/master/lib/Red.pm6#L36 [08:44] *** notagoodidea joined [08:54] moon-child: I found this "old" perl6 module by azawawi (https://github.com/azawawi/p6-libclang) that wrap libclang. And after a deep look at the sokol bindgen, there is nothing that specific. [08:55] the main problem is for now the JSON parsing. I have to try different modules available and worst case scenario use jq for that part. [08:57] or accept the JSON as string and try to parse with a grammar or whatnot. [09:02] notagoodidea: timotimo works on json::fast, he might have a suggestion [09:03] *** pecastro joined [09:06] *** dakkar joined [09:07] *** notagoodidea left [09:15] *** ufobat joined [09:17] *** aborazmeh joined [09:17] *** aborazmeh left [09:17] *** aborazmeh joined [09:17] *** ufobat__ left [09:21] *** JRaspass joined [09:23] *** tejr left [09:32] *** notagoodidea joined [09:36] *** sno left [09:39] *** Xliff joined [09:42] *** aborazmeh left [10:25] *** jmchael joined [10:33] * lizmat clickbaits https://rakudoweekly.blog/2021/01/11/2021-01-02-so-much-new-stuff/ [10:34] *** cono joined [10:34] p6: class { has %!h = a => 42; submethod BUILD() { %!h.say } }.new [10:34] rakudo-moar d53a92733: OUTPUT: «{}␤» [10:35] BUILD is funny like that [10:35] p6: class { has %!h = a => 42; submethod TWEAK() { %!h.say } }.new [10:35] rakudo-moar d53a92733: OUTPUT: «{a => 42}␤» [10:35] p6: class { has %!h = a => 42; submethod BUILD() { %!h.say }; method g { %!h.say } }.new.g [10:35] rakudo-moar d53a92733: OUTPUT: «{}␤{}␤» [10:36] why I don't see it in method g? [10:37] becuase your BUILD breaks attribute initialization [10:38] it's not like Moose's BUILD, if you're familiar with that one, it does a bit more and it's often confusing, that's why TWEAK came to be [10:38] I wish I could tell you exactly what BUILD does and how to make it do what you need, but I just hate it, not understand it and never use it :P [10:39] but generally BUILD is the bit responsible for setting attribute values, so if you define your own BUILD then it's up to you to set them [10:43] oh [10:43] I thought BUILD's responsibility is only to set values passed by the arguments. But looks like assigning them in class, also done in BUILD [10:44] complex [10:44] thanks for explanation! tadzik++ [10:45] you're welcome, I hope I got it right :P [10:45] I don't understand something. Using only JSON::Fast from-json and to-json, the to-json function is super slow. Same json file but using JSON::simd to load and to-json again from JSON::Fast to dump is super fast. [10:46] is due to the fact that JSON::simd create a raku hash instead of a string for the load? [10:48] notagoodidea: which version of JSON::Fast do you have ? [10:51] I just installed yesterday with zef, let me check. [10:51] 0.15 [10:54] the JSON provided is ~160K lines (it is a dump from clang ast of curl.h) [10:56] ok, then I don't think I have any suggestions to make things faster in the short term [10:58] With JSON::simd for loading and JSON::Fast for dumping, it is fast enough. [10:58] Using only JSON::Fast, loading is fast but dumping is really slow. [10:59] my guess is the from-json from Fast output a Str instead of a Hash and to-json have a bad time with it. [11:08] *** abraxxa1 left [11:08] *** abraxxa1 joined [11:12] *** PimDaniel joined [11:13] Hi! everybody's waked up? [11:13] Ok, i'll start with a simple question: [11:15] what's the difference between : my @l = <1, 2, 3>; and my @l = 1, 2, 3; ? thank's! [11:15] `<> ` in this case is a quoting construct [11:16] that automatically splits on whitespace [11:16] so my syntax is wrong : i do not have the , [11:17] my @l = <1 2 3>; [11:17] *** thdrmz left [11:18] *** thdrmz joined [11:18] that'll create an array of strings (which in this case will actually be IntStrs, since they "look" like numbers) [11:18] *** sno joined [11:19] m: dd <1 2 3>; dd 1, 2, 3 [11:19] rakudo-moar a13ea269a: OUTPUT: «(IntStr.new(1, "1"), IntStr.new(2, "2"), IntStr.new(3, "3"))␤1␤2␤3␤» [11:20] *** asymptotically left [11:20] MasterDuke : thank you , i'm looking at https://docs.raku.org/language/quoting [11:22] *** PimDaniel left [11:26] ok thinks are getting weirder [11:28] * MasterDuke pages Dr. Freud [11:28] `use JSON::Fast; my \x = slurp("curl-test.json") ==> from-json; my \xo = to-json x;` runs in [11:29] 605sec [11:30] idem if you swap `use JSON::Fast` by `use JSON::simd :subs;` [11:30] *** Altai-man joined [11:32] *** sena_kun left [11:36] I guess it's the to-json that's slow, not the from-json, and JSON::simd just uses JSON::Fast's to-json()? [11:37] from JSON::simd's docs: As an added bonus, this also imports to-json from JSON::Fast, which works exactly as usual [11:38] yes but [11:38] 'use JSON::simd; use JSON::Fast; my $json = JSON::simd.new; my \x = $json.load: "curl-test.json"; my \xo = to-json x;' [11:38] runs in [11:39] 4.6s [11:39] *** aluaces left [11:41] I think that the from-json imported with :subs respects the interface of JSON::Fast by providing a Str [11:42] *** Toilie is now known as dudz [11:43] *** dudz left [11:43] *** dudz joined [11:45] *** Black_Ribbon left [11:48] tadzik: yep it returns a Str and when used the OO way it returns a Hash. to-json is fast with a hash and slow with a Str. [11:49] or I messed something with the feed operator in the declaration? [11:51] yep it is on me. [11:52] with the feed operator, the subs from JSON::simd runs in the time that the OO approach. [11:53] is there a precedence with assignement vs feed operator? [11:59] m: my $x = "foo" ==> map *.uc; say $x; [11:59] rakudo-moar 9e13ace80: OUTPUT: «foo␤» [12:01] m: my $x = do "foo" ==> map *.uc; say $x; [12:01] rakudo-moar 9e13ace80: OUTPUT: «(FOO)␤» [12:03] wait, what [12:04] if something returns a Str from JSON parsing, is it even parsing it at all? [12:04] sure, `"foo"` is a valid JSON-encoded string value [12:05] (but I think that's not the issue here) [12:05] tadzik: I will test without my mistake to check what JSON::Fast returns [12:06] dakkar: it's valid, yeah, but if I think if one parsing method returns a Hash and another returns a Str then at least one of them is wrong :P [12:06] tadzik: it returns an Hash [12:06] for some value of wrong anyway... https://github.com/qntm/fastjson [12:07] The mistake is on me by using the feed operator in the assignement [12:09] would it be too snarky to say it seems to me that much of npm would belong in the Acme:: namepace in CPAN? [12:09] and Fast is the fastest [12:10] lizmat: in case of, the problem was pebak not JSON::Fast [12:12] *phew* :-) [12:12] *** aborazmeh joined [12:12] *** aborazmeh left [12:12] *** aborazmeh joined [12:15] MasterDuke: I just assume everything on npm is sarcastic :P [12:20] *** PimDaniel joined [12:20] Hi! [12:21] Modify array by ref with a sub: [12:21] look a my piece of code : https://pastebin.com/8Tc463py [12:22] In Perl5 it was bad to use $_ unless we declared it local. [12:23] Is it safe tu use $_ in a for loop in raku like i did with sub b(@r) {...} in my paste_bin given example? [12:24] if no : could we declare loop variable -> $e as rw? [12:29] *** aborazmeh left [12:30] *** BenGoldberg left [12:30] *** Ben_Goldberg joined [12:30] *** Ben_Goldberg is now known as BenGoldberg [12:33] Thank's in advance! [12:35] you can use for @a <-> $n { $n = 42 } [12:35] or [12:35] for @a -> $n is rw { $n = 42 } [12:37] *** codesect` joined [12:39] *** codesections left [12:39] moritz : thank your very mutch! [12:45] *** PimDaniel left [12:47] *** aborazmeh joined [12:47] *** aborazmeh left [12:47] *** aborazmeh joined [12:59] *** aluaces joined [13:07] *** k-man left [13:18] *** k-man joined [13:29] *** notagoodidea left [13:51] *** dakkar left [13:51] *** aborazmeh left [13:55] *** dakkar joined [13:57] *** domidumont left [14:03] *** thdrmz left [14:15] *** vrurg joined [14:20] *** thdrmz joined [14:21] *** aborazmeh joined [14:21] *** aborazmeh left [14:21] *** aborazmeh joined [14:27] *** notagoodidea joined [14:38] *** MasterDuke left [14:39] *** parabolize joined [14:58] *** rindolf left [15:03] *** wamba left [15:05] *** codesect` left [15:06] *** MasterDuke joined [15:06] *** codesections joined [15:13] *** rindolf joined [15:14] OK, how is this for weirdness? [15:15] https://repl.it/@Xliff/SorrowfulFlawedMicrobsd#main.raku [15:15] This REPL illustrates a problem that's been driving me batty. [15:15] The same piece of code is executed. One via MAIN:: the other via a class in another compunit. [15:16] The MAIN:: code runs fine. It craps out when it's in a compunit. [15:16] "Help!" he says! [15:16] *** cpan-raku left [15:17] *** cpan-raku joined [15:17] *** cpan-raku left [15:17] *** cpan-raku joined [15:20] *** Sgeo joined [15:30] *** sena_kun joined [15:32] *** aborazmeh left [15:32] *** Altai-man left [15:36] *** aborazmeh joined [15:36] *** aborazmeh left [15:36] *** aborazmeh joined [15:41] *** aborazmeh left [15:53] *** aborazmeh joined [15:53] *** aborazmeh left [15:53] *** aborazmeh joined [16:03] *** aborazmeh left [16:08] *** domidumont joined [16:11] Can you get the instance of an object from one of its Methods? [16:12] *** atroxaper joined [16:12] Hi, #raku [16:13] Xliff: no, methods are generally not bound to instances (unlike in, say, python) [16:13] Am I right that wrap method do not change the Signature? What if I want to change it any way? Is it possible? [16:14] moritz: Ah, thanks. [16:15] moritz: OK, how about this. Can an inner-sub gain access to class attributes somehow? [16:15] m: class A { has $!a; sub b { say $!a }; method c { b } }; A.new(a => 42).c [16:15] rakudo-moar 12b49b834: OUTPUT: «5===SORRY!5=== Error while compiling ␤Variable $!a used where no 'self' is available␤at :1␤------> 3class A { has $!a; sub b { say $!a7⏏5 }; method c { b } }; A.new(a => 42).c␤» [16:15] *** thdrmz left [16:15] Yeah. Figured that. [16:16] Barring that... class defined traits. :/ [16:16] well, you could put sub b inside method c [16:17] then it gets self as an outer lexical [16:17] or you could pass in `self` explicitly [16:17] m: class A { has $!a; sub b(self) { say $!a }; method c { b } }; A.new(a => 42).c [16:17] rakudo-moar 12b49b834: OUTPUT: «5===SORRY!5=== Error while compiling ␤Invalid typename 'self' in parameter declaration.␤at :1␤------> 3class A { has $!a; sub b(self7⏏5) { say $!a }; method c { b } }; A.new(a␤» [16:17] Yeah, but I am trying to apply trait mods to methods, but the trait would need access to the object. [16:18] m: class A { has $!a; sub b(\self) { say $!a }; method c { b } }; A.new(a => 42).c [16:18] rakudo-moar 12b49b834: OUTPUT: «5===SORRY!5=== Error while compiling ␤Variable $!a used where no 'self' is available␤at :1␤------> 3lass A { has $!a; sub b(\self) { say $!a7⏏5 }; method c { b } }; A.new(a => 42).c␤» [16:18] So... more like: class A { method b is blah { ... } }; [16:18] Xliff: well, then `self` is the first argument passed to that method [16:18] and you trait then needs to go through that [16:18] and possibly the MOP [16:19] So.... [16:20] If I wrap a method, I could maybe do... [16:20] $m.wrap(sub (|c) { c.list[0] # instance? }) [16:21] or just $m.wrap(sub (\SELF, |c) { SELF is invocant here }) [16:21] *** _jrjsmrtn joined [16:21] Cool! [16:23] *** __jrjsmrtn__ left [16:28] how to I test a type of a variable? [16:29] $foo ~~ Str [16:29] m: my $foo = Any; say $foo.^name =:= Any; [16:29] rakudo-moar 12b49b834: OUTPUT: «False␤» [16:29] m: my $foo = Any; say $foo.^name ~~ Any; [16:29] rakudo-moar 12b49b834: OUTPUT: «True␤» [16:30] thanks! [16:40] Perl guru help here, pls. [16:40] https://repl.it/@Xliff/SorrowfulFlawedMicrobsd#main.raku [16:41] Why does the code in MAIN:: work, but the code from the compunit bomb? [17:08] notagoodidea: there's a module for the fastest, or it was, json lib somewhere [17:08] its limitting factor is the c/raku marshalling iirc [17:08] *** asymptotically joined [17:09] but it has some opti for certain cases to ameliorate that [17:09] Json::Fast is good in enough for now, crunching load and dump under [17:09] 2s [17:10] I think my filter and extract methods will take more time. [17:10] *** tejr joined [17:10] ah, you found it - JSON::simd [17:11] backlogging and skipped a bit:( [17:11] cool [17:12] no trouble. I don't think that I may leverage the delay args from simd so Fast is faster due to the C/raku marshalling on a big json, afaik [17:14] m:say Hash ~~ Any [17:14] notagoodidea, rakudo-moar 12b49b834: OUTPUT: «True␤» [17:16] m: say Any ~~Hash; [17:16] rakudo-moar 12b49b834: OUTPUT: «False␤» [17:16] That was confusing. [17:16] *** b2gills left [17:16] *** Kaiepi left [17:23] Xliff: I have fixed your code. But I don't know how to share it in relp.it ^^ [17:23] <[Coke]> can always post in gist.github.com - what was the fix? [17:23] 2021-01-11T06:12:48Z #raku [Coke] thanks! [17:27] [Coke]: Oh, sure. Thanks. [17:27] Xliff: https://gist.github.com/atroxaper/5b450550bea5eb4915c617f74e3af844 see my comments [17:32] *** guifa joined [17:32] *** wamba joined [17:34] *** MasterDuke left [17:37] *** dakkar left [17:38] *** b2gills joined [17:38] *** notagoodidea left [17:45] *** lucasb joined [17:46] *** Kaiepi joined [17:47] atroxaper: Thanks! What was the problem? [17:49] OK, I see. Still... isn't it LTA to have to create a sub and "use soft"? [17:49] Xliff: actually, I don't know. They said, that wrap is mostly untested part of Rakudo... Probably, GC clears the anon sub. [17:50] OK. Thanks. Now to see if your solution works in the larger piece of code. Thanks! [17:51] Xliff: you do not have to use 'use soft'. It was my mistake. [17:51] Xliff: You're welcome :) [17:51] One other thing... using it in a sub like this means I lose access to the Method object. [17:51] Any ideas on how to get that into the sub? [17:51] So I need access to \m in foo [17:52] Hummm.... maybe... [17:53] nextcallee?!? [17:53] I finally found a use for that! LOL! [17:55] Xliff: Oh! Great find :) [17:59] lucs: the reason for calling them distributions is that a distribution can (and often does) contain multiple modules [18:00] *sigh* -- still breaks in orignial code with "Cannot invoke object with invocation handler in this context" [18:09] *** natrys joined [18:35] <[Coke]> .seen codesections [18:35] [Coke], I saw codesections 2021-01-10T19:50:55Z in #raku: will do :) [18:37] *** dazage joined [18:39] *** dazage left [18:40] Xliff: Probably this will lead to the right thoughts. Maybe you do not need an access to the method in foo. https://gist.github.com/gfldex/22f9133dbdb83c21c8e4 [18:40] Xliff: https://perl6advent.wordpress.com/2015/12/13/a-new-trait-for-old-methods/ [18:42] guifa: Aha, makese sense. Thanks. [18:42] 2. [18:42] 2021-01-12T00:06:19Z #raku tony-o please take a look at this - https://github.com/tony-o/raku-fez/pull/15 , thanks [18:42] 2021-01-12T00:30:15Z #raku tony-o I've added integration test for `fez meta` [18:42] 2021-01-12T00:31:24Z #raku tony-o maybe I should push all the tests to fez repo? i don't know ... [18:42] 2021-01-12T03:26:40Z #raku tony-o I put fez-test sparky configuration - https://github.com/melezhik/sparky-playground/tree/main/fez-test so far ... cc tib [18:43] .tell melezhik you're welcome to push tests. #15 is merged [18:43] tony-o, I'll pass your message to melezhik [18:44] *** cpan-raku left [18:46] <[Coke]> did the behavior of chdir in rakudo change in the past few months? [18:47] <[Coke]> based on behavior of a raku/doc xt/ test, it looks like it might have previously been lexically scoped? [18:49] ¦ doc: coke self-assigned xt/check-signatures.t skips all tests https://github.com/Raku/doc/issues/3765 [18:50] ¦ doc: 7e96ae04e5 | Coke++ | xt/check-signatures.t [18:50] ¦ doc: Look for doc files in doc folder [18:50] ¦ doc: [18:50] ¦ doc: Without this fix, recent rakudos were looking in the RAKUDO_SRC dir (post chdir) [18:50] ¦ doc: [18:50] ¦ doc: Fixes #3765 [18:50] ¦ doc: review: https://github.com/Raku/doc/commit/7e96ae04e5 [18:50] DOC#3765 [closed]: https://github.com/Raku/doc/issues/3765 [docs] xt/check-signatures.t skips all tests [18:51] *** jmerelo left [18:52] Am I right that wrap method do not change the Signature? What if I want to change it any way? Is it possible? [18:55] <[Coke]> codesections: fixed #3765; now left with a single failure running the signature test. [18:56] *** domidumont left [18:56] *** natrys left [18:57] *** notagoodidea joined [18:59] atroxaper: yes and no. wrap can wrap with any new signature, but it’s possible the compiler will be overly strict at compile time and think it impossible [19:00] So if the original sub has both slurpies on it, you can do anything you want. If the original only takes a single positional, you’ll probably be unfortunately stuck with the single positional (but named arguments should genreally work) [19:00] guifa: It fails in runtime, actually. [19:00] odd, when I get issuse with it, it’s always compile time [19:01] ¦ doc: coke assigned to codesections Issue check-signature test cannot find some method definitions. https://github.com/Raku/doc/issues/3780 [19:01] m: sub foo($a) { say $a }; &foo.wrap: -> $a, $b { samewith $a }; foo 1, 2; [19:01] rakudo-moar 12b49b834: OUTPUT: «5===SORRY!5=== Error while compiling ␤Calling foo(Int, Int) will never work with declared signature ($a)␤at :1␤------> 3; &foo.wrap: -> $a, $b { samewith $a }; 7⏏5foo 1, 2;␤» [19:02] *** sortiz joined [19:02] guifa: Oh... Apparently, I was wrong. [19:07] guifa: I just thinking for fun... Could I implement something similar as Python's decorators. They take a sub and return a 'wrapped' sub to original name. [19:07] *** cpan-raku joined [19:07] *** cpan-raku left [19:07] *** cpan-raku joined [19:10] *** natrys joined [19:15] I’m not familiar enough with Python to know the difference between that and wrapping. Wrapping has global effect, so you could write a sub that takes another one as an argument, and in turn wraps it. [19:15] m: sub foo { say "hi" }; sub wrap-me(&f) { &f.wrap: sub { callsame; say "bye" } }; foo; say "---"; wrap-me &foo; foo; [19:15] rakudo-moar 12b49b834: OUTPUT: «hi␤---␤hi␤bye␤» [19:18] If you want to return a sub while preserving the original, you don’t need to use wrap, just return a code block of some sort: [19:18] sub foo { say "hi" }; sub wrap-me(&f) { sub {f; say "bye"} }; foo; say "---"; my &bar = wrap-me &foo; bar [19:18] guifa, rakudo-moar 12b49b834: OUTPUT: «hi␤---␤hi␤bye␤» [19:20] guifa: Yes, I know that. Thank you for examples :) [19:22] is it a sane way to loop around elements of hash containing arrays containg hashes etc for which I don't know the depth? [19:22] it's coming from a JSON. The keys of the hash are the same at differents depth. [19:30] *** Altai-man joined [19:31] ¦ ecosystem: 4de08385a4 | (David Warring)++ | META.list [19:31] ¦ ecosystem: move remaining modules from the pdf-raku project to CPAN [19:31] ¦ ecosystem: review: https://github.com/Raku/ecosystem/commit/4de08385a4 [19:32] *** sena_kun left [19:34] notagoodidea: sure, depending on the exact structure you can go about it different ways [19:35] my @a = 1, 2, [1,2,3]; for @a -> $b { .say for $b<> } [19:35] guifa, rakudo-moar 12b49b834: OUTPUT: «1␤2␤1␤2␤3␤» [19:36] the structure could be now at runtime by testing a bit. [19:38] The two elements that I know : I need to follow the key `inner` to go deeper in the structure, and at the last level of depth I will find a key `name`. [19:39] Each time the `inner` key contains an array that contains the next hash. [19:39] mm I could use loop or until .. [19:39] *** BenGoldberg left [19:39] *** Ben_Goldberg joined [19:39] *** Ben_Goldberg is now known as BenGoldberg [19:43] *** atroxaper left [19:48] *** ufobat left [19:48] *** b2gills1 joined [19:48] *** b2gills left [19:53] *** PimDaniel joined [19:54] hi, this is me again. [19:56] I'm reading https://docs.raku.org/language/packages and https://docs.raku.org/language/modules and https://docs.raku.org/language/modules-packages. [19:57] *** wamba left [19:57] and i do not understand the relationship between package and modules. Probably the language does not bind my brain! [19:58] I mean "English language". [19:58] A package is just a way to collect variables/subroutines/etc. Classes are also packages, for instance. [19:59] *** tejr left [20:00] @guifa thank you! So what is a module? [20:01] A module is type of package specially designed for importing symbols (variables, subroutines, settings, etc) into code [20:04] @guifa : Merci! Physically, suppose i want to write a Module... is it the same than in perl5? [20:04] What is the file extension i should use? [20:05] I do not see this in the documentation. [20:05] hooo : Chapter "Modules on disk" : Sorry! :( [20:09] *** tejr joined [20:09] * guifa is afk for a bit [20:10] *** Black_Ribbon joined [20:11] Does unit means namespace? [20:13] No No : sorry! [20:21] @guifa : Ok : i see clearly now: thank you very mutch! [20:26] *** JRaspass left [20:26] *** JRaspass joined [20:26] *** PimDaniel left [20:27] *** JRaspass left [20:27] *** JRaspass joined [20:32] *** sjm_uk left [20:42] <[Coke]> "unit" is how you declare the thing. so "unit module blah;" is the first line of a file, the entire file is the module blah. otherwise you need to use {} for scoping with the module/class/whatever. [20:43] <[Coke]> file extensions: .raku for programs, .rakumod for modules [20:43] <[Coke]> Hope this helps. [20:44] <[Coke]> that feeling of ... not-quite-dread about an upcoming meeting... that is suddenly pushed out a day. ahhhh. [20:48] *** natrys left [20:48] *** mowcat joined [21:01] *** Ben_Goldberg joined [21:01] *** BenGoldberg left [21:01] *** Ben_Goldberg is now known as BenGoldberg [21:02] *** rindolf left [21:02] *** Ben_Goldberg joined [21:02] *** BenGoldberg left [21:02] *** Ben_Goldberg is now known as BenGoldberg [21:07] *** Ben_Goldberg joined [21:07] *** BenGoldberg left [21:07] *** Ben_Goldberg is now known as BenGoldberg [21:20] *** BenGoldberg left [21:20] *** Ben_Goldberg joined [21:20] *** Ben_Goldberg is now known as BenGoldberg [21:33] *** BenGoldberg left [21:33] *** Ben_Goldberg joined [21:33] *** Ben_Goldberg is now known as BenGoldberg [21:35] does unit just mean the rest of this file belongs to this package? [21:36] less "the rest", more "the entirity" IMO [21:36] ahh [21:40] *** Altai-man left [21:42] *** MasterDuke joined [21:42] *** sena_kun joined [21:43] <[Coke]> m: say "hi"; unit package bar; [21:43] rakudo-moar 12b49b834: OUTPUT: «hi␤» [21:43] <[Coke]> ... I'm surprised that doesnt' error. :) [21:44] *** PimDaniel joined [21:44] *** PimDaniel left [21:48] *** sena_kun left [21:50] *** benjif joined [21:53] *** BenGoldberg left [21:53] *** Ben_Goldberg joined [21:54] *** Ben_Goldberg is now known as BenGoldberg [21:55] BenGoldberg: everything alright? [21:58] *** BenGoldberg left [21:58] *** Ben_Goldberg joined [21:59] *** Ben_Goldberg is now known as BenGoldberg [22:00] *** stoned75 left [22:02] stuff that doesn't define anything should in general be fine i'd imagine [22:07] *** simcop2387 joined [22:15] [Coke]: you need to put stuff above the unit declaration in case you have to, e.g. parameterize a class or pass something into a trait, so it makes sense to allow code above the declaration [22:16] *** BenGoldberg left [22:16] *** Ben_Goldberg joined [22:17] *** Ben_Goldberg is now known as BenGoldberg [22:21] <[Coke]> guifa++ [22:24] *** notagoodidea left [22:25] <[Coke]> m: say Mixy.^methods [22:25] rakudo-moar 12b49b834: OUTPUT: «(of new-from-pairs)␤» [22:25] <[Coke]> docs say that Mixy provides total & roll, but it doesn't. [22:26] *** BenGoldberg left [22:26] *** Ben_Goldberg joined [22:26] *** Ben_Goldberg is now known as BenGoldberg [22:26] <[Coke]> (doesn't provide *total*) [22:26] [Coke]: it definitely does though: https://github.com/rakudo/rakudo/blob/master/src/core.c/Mixy.pm6 [22:27] at least, roll is there [22:29] <[Coke]> wasn't clear: docs say both, but total isn't there. [22:30] <[Coke]> total appears to be in Mix, not Mixy. [22:32] *** brtastic left [22:33] <[Coke]> (wow, that method was docced back when the doc files were in lib/) [22:38] ¦ doc: 7bac622b20 | Coke++ | 2 files [22:38] ¦ doc: Move total method to Mix from Mixy [22:38] ¦ doc: [22:38] ¦ doc: xt/check-signatures.t found this, presented as a SKIP'd test. [22:38] ¦ doc: [22:38] ¦ doc: Investigation showed the method was defined in the wrong spot, [22:38] ¦ doc: and when moved, that the signature needed a slight update. [22:38] ¦ doc: review: https://github.com/Raku/doc/commit/7bac622b20 [22:40] *** benjif left [22:41] *** aluaces left [22:54] *** melezhik joined [22:58] Is there any module or operator I can use to compare strings and return which ones 'kinda' match? Like how spellcheck presumably works in word processing applications? [23:00] kawaii: there are a few different algorithms for calculating the difference between strings [23:00] kawaii: try one of these maybe https://modules.raku.org/search/?q=levenshtein [23:00] There are a few different modules for that [23:00] I’d then make an operator for it [23:00] Ah, nice, thanks very much guys :) [23:02] sub infix: ($a, $b, :$similarity-factor) { my $distance = distance-function-of-your-choice $a, $b; {formula to convert distance to similarity} > $similarity-factor } [23:03] If you need it in a regex … [23:03] https://github.com/alabamenhu/RegexFuzzyToken [23:13] *** bdju left [23:14] *** bdju joined [23:15] https://github.com/MasterDuke17/Text-Diff-Sift4 another alternative. i haven't benchmarked it against the levenshtein modules recently, but it used to be quite a bit faster, although not giving identical results [23:15] *** bdju left [23:16] MasterDuke: thank you! I will evaluate its fitness for my project also :) [23:19] *** bdju joined [23:23] if you write your own, feel free to compete on https://code.golf/levenshtein-distance#raku ;-) [23:33] MasterDuke; am I perhaps going about this the wrong way? I'm basically writing a bot where a user will enter a command like `!team ` and it will return some info on that member, but of course users shouldn't be expected to know the exact string and capitalisation required so I wanted to do something like this to try and help them out. https://www.irccloud.com/pastebin/F2l2F7lw/ [23:34] But it seems as though some of my keys are too similar to make an informed decision based on the results. [23:34] Perhaps there is a better way? [23:37] hmm, let’s see how it would work with Joccard Index [23:38] *** melezhik left [23:42] kawaii: try this one: https://bit.ly/39rUJuP [23:43] It’s not as fast, but it sounds like speed isn’t your concern here — when I ignore case, the two Toms are tied for top place. [23:44] Aha this is more or less exactly what I wanted [23:45] guifa: thank you for your help this evening, I really appreciate it [23:46] You're right, searching for 'tom' does indeed tie both of them, and 'tomm' correctly prefers Tomm M [23:47] Luckily, @results is an ordered array, so I can simply choose the first in my edge case and present the user with Tom K [23:49] Yup. Or do other things like evaluate based on the scores — I think anything over .33 is a reasonable enough match, and so you could present them with an option for those matches, and possible average values over running it with and without matching marks, whitespace, or capitalization (that’s what those &i, &m, &ws functions were for) [23:49] *** pecastro left [23:49] .tell jnthn Is there any way to introspect the symbol table of a template during render()? [23:50] Xliff, I'll pass your message to jnthn [23:50] guifa: many thanks again for your help :)