[00:01] m: dd $*RAKU.compiler [00:01] rakudo-moar 2db92e04f: OUTPUT: «Compiler rakudo = Compiler.new(id => "B0D6A0338B85BFBFE1C14B4AEDA60C0788BB2C25", release => "", codename => "", name => "rakudo", auth => "The Perl Foundation", version => v2020.07.66.g.2.db.92.e.04.f, signature => Blob, desc => Str)␤» [00:24] *** mowcat left [00:51] *** Altai-man joined [00:53] *** sena_kun left [01:03] *** _jrjsmrtn joined [01:05] *** __jrjsmrtn__ left [01:10] *** gugod left [01:13] *** gugod joined [01:17] *** gugod left [01:17] *** gugod joined [01:17] *** gugod left [01:17] *** gugod joined [01:18] *** gugod left [01:18] *** gugod joined [01:27] *** kotrcka joined [01:56] *** cpan-raku left [01:59] *** cpan-raku joined [01:59] *** cpan-raku left [01:59] *** cpan-raku joined [02:02] *** Noisytoot left [02:19] *** ilogger2 joined [02:20] *** go|dfish joined [02:35] *** fooist joined [02:38] *** Cabanossi joined [02:40] Does anyone here know what the status/provenance is of the p6dists.json.gz file in CPAN (under /authors)? Sorry [02:41] Total raku #n00b [02:42] Mostly wondering if it’s officially supported [03:51] *** hungrydonkey joined [04:00] *** rockxloose joined [04:54] *** sena_kun joined [05:05] *** finanalyst joined [05:08] fooist: iirc it's the file that package managers use to get a list of p6/raku distributions on CPAN [05:22] *** stoned75 joined [05:22] *** epony joined [05:37] *** bocaneri joined [07:07] *** sjm_uk joined [07:10] *** sarna joined [07:12] *** hungrydonkey left [07:13] o/ [07:15] ¦ ecosystem: 318bb77d0d | (Daniel Lathrop)++ (committed using GitHub Web editor) | META.list [07:15] ¦ ecosystem: remove duplicate from META.list [07:15] ¦ ecosystem: review: https://github.com/Raku/ecosystem/commit/318bb77d0d [07:15] ¦ ecosystem: 14877cef2d | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list [07:15] ¦ ecosystem: Merge pull request #526 from fooist/patch-1 [07:15] ¦ ecosystem: [07:15] ¦ ecosystem: remove duplicate from META.list [07:15] ¦ ecosystem: review: https://github.com/Raku/ecosystem/commit/14877cef2d [07:15] *** hungrydonkey joined [07:18] *** oddp joined [07:20] *** JJMerelo joined [07:22] m: say join("hello ", "world"); say ("hello ", "world").join; # is there a viable use case for `sub join` when `*@list` has < 2 things in it? [07:22] rakudo-moar 2db92e04f: OUTPUT: «world␤hello world␤» [07:29] what's happened to "hello"? [07:29] 2020-08-16T21:06:49Z #raku JJMerelo https://github.com/Raku/advent/blob/master/20th/articles/rfc200.md [07:29] 2020-08-17T22:52:12Z #raku jjmerelo: how often are public-facing doc pages regenerated? do i need to trash my browser cache to see an update? [07:29] .tell tbrowder they are updated... from time to time. I'll do it today. [07:29] JJMerelo, I'll pass your message to tbrowder [07:33] JJMerelo: sub's signature is `sub join($separator, *@list)`, it thinks "hello " is the separator, and "world" is the list :( [07:33] it's very confusing when you first encounter it [07:33] Ah, right, of course... [07:35] it could check the length of the list, but idk about performance loss/use cases I missed [07:44] *** stoned75 left [07:45] *** dakkar joined [07:48] *** xinming joined [07:54] *** stoned75 joined [08:04] ¦ advent: 51018fd824 | (JJ Merelo)++ | 20th/articles/rfc265.md [08:04] ¦ advent: Minor modifications [08:04] ¦ advent: review: https://github.com/Raku/advent/commit/51018fd824 [08:11] *** hungrydonkey left [08:32] ¦ ecosystem: 9f1c7aa568 | (JJ Merelo)++ | 2 files [08:32] ¦ ecosystem: Rearranges test file [08:32] ¦ ecosystem: [08:32] ¦ ecosystem: So that it builds before testing for the existence of files. Closes #527 [08:32] ¦ ecosystem: It also updates to use the latest version of the Docker container, which includes make and gcc [08:32] ¦ ecosystem: review: https://github.com/Raku/ecosystem/commit/9f1c7aa568 [08:47] *** [Sno] joined [08:51] *** Altai-man joined [08:54] *** sena_kun left [09:02] *** rindolf joined [09:05] *** JJMerelo left [09:56] .tell jjmerelo thnx, amigo [09:56] tbrowder, I'll pass your message to JJMerelo [09:57] gracias [09:57] 2020-08-19T07:29:38Z #raku tbrowder they are updated... from time to time. I'll do it today. [10:04] *** hungrydonkey joined [10:13] is there really no way of preventing Nil propagation in method chains? I'd prefer it to fail fast :( [10:19] *** sjm_uk left [10:20] can I maybe specify that I want to take `self:D`? not sure how to do that.. [10:21] oh no, that wouldn't work, since every method called on Nil returns Nil >.> [10:25] *** [Sno] left [10:29] *** JJMerelo joined [10:29] *** yangzq50 joined [10:29] sarna: hmmm, you seem to be right, that doesn't work; I'm a bit surprised [10:29] m: class A { method n { Nil }; method non-nil(A:D $:) { 42}}; say A.new.n.non-nil [10:29] rakudo-moar 2db92e04f: OUTPUT: «Nil␤» [10:29] codesections: I've found this - https://stackoverflow.com/questions/60155276/i-can-call-any-method-on-nil-and-this-feels-wrong/60155442#60155442 [10:30] I don't find the reasoning (not having to insert null checks between chains) that convincing [10:30] m: class A { method n { Nil }; method non-nil(A:D $:) { 42}}; my $foo = A.new.n; say $foo.non-nil [10:30] rakudo-moar 2db92e04f: OUTPUT: «No such method 'non-nil' for invocant of type 'Any'␤ in block at line 1␤␤» [10:31] this dies (as it should), but you have to break up your method chains like this, every time.. [10:33] And that makes sense, given how assigning Nil works [10:34] yeah, but I'd say the default behavior is LTA - nothing less fun than hunting for a bug that propagated from something deep down the call stack [10:35] Nil carries absolutely no information [10:35] m: class A { method n { Nil }; method non-nil(A:D $:) { 42}}; say (my $ = A.new.n).non-nil [10:35] rakudo-moar 2db92e04f: OUTPUT: «No such method 'non-nil' for invocant of type 'Any'␤ in block at line 1␤␤» [10:35] that's pretty ugly, though [10:37] it is, and the ugliness is O(n) where n is the number of methods in a chain [10:38] Yep! [10:38] Though, I think it'd work without the `my` which helps (very slightly) [10:40] maybe raku has something like dart's cascade notation? that would help - https://stackoverflow.com/questions/49447736/list-use-of-double-dot-in-dart [10:42] I may be onto something [10:42] m: class A { method n { Nil }; method non-nil(A:D $:) { 42}}; $ = A.new.n; $ .= non-nil; .say [10:42] rakudo-moar 2db92e04f: OUTPUT: «No such method 'non-nil' for invocant of type 'Any'␤ in block at line 1␤␤» [10:43] just replace all dots with `$ .=` et voila [10:44] Is that really less ugly than [10:44] m: class A { method n { Nil }; method non-nil(A:D $:) { 42}}; say ($ =A.new.n).non-nil [10:44] rakudo-moar 2db92e04f: OUTPUT: «No such method 'non-nil' for invocant of type 'Any'␤ in block at line 1␤␤» [10:45] semicolons instead of parens? :D [10:46] mine would read better when splitted across multiple lines [10:47] *** yangzq50 left [10:47] oooh, I think I have something: [10:47] m: sub postfix:<‽>($a) { $ = $a}; class A { method n { Nil }; method non-nil(A:D $:) { 42}}; say A.new.n‽.non-nil [10:47] rakudo-moar 2db92e04f: OUTPUT: «No such method 'non-nil' for invocant of type 'Any'␤ in block at line 1␤␤» [10:49] codesections: what's that? [10:50] oh darn it's your own operator [10:50] I searched for it in the docs :DDD [10:50] :D [10:50] I love this [10:50] also I hate this [10:51] Agreed [10:53] noo you can't do ‽. :((( [10:53] all the methods have to be on one line [10:54] *** [Sno] joined [10:56] Hmmm, I've run into that problem with &.subroutine method calls too [11:01] it's probably better to extinguish that behavior at the source if you dislike it and don't want to change your entire code to a new method call operator: [11:02] m: Nil.^find_method("FALLBACK").wrap: -> $, $ { fail 'method call on Nil' }; class A { method n { Nil }; method non-nil (A:D $:) { 42 } }; say A.new.n.non-nil [11:02] rakudo-moar 2db92e04f: OUTPUT: «method call on Nil␤ in block at line 1␤␤» [11:02] monkey patching Nil because I don't like a design decision? is that legal? [11:03] by keeping the return value of that wrap call you can make the change lexical by unwrapping at scope exit [11:03] actually, I am not sure how stable wrapping core class's methods is [11:04] that still seems heavy-handed, and confusing to whoever will come and look at my code [11:04] tobs: I like that approach. It strikes me that forgetting to unwrap that at the end of a scope could break … lots of things, though [11:08] *** aluaces joined [11:08] *** aluaces is now known as alberto [11:09] sarna: I'm not getting an error when breaking the method chain across multiple lines with the new operator [11:09] *** alberto is now known as Guest47135 [11:09] codesections: where do you break it? I tried `foo?!.bar` and I kept getting "bogus operator" [11:11] hi, anyone use raku on win 10 as primary os? [11:12] *** xinming left [11:12] if so, what is preferred raku installation method and editor? thnx [11:13] *** xinming joined [11:14] win is not my cup of tea, but trying to wean grandson off python and such [11:15] as is taught in govt schools [11:22] Is there some way to switch the state of a Bool between True/False without doing some janky if statement saying `if $blah = True { $blah = False }`? :) [11:22] *** aborazmeh joined [11:22] *** aborazmeh left [11:22] *** aborazmeh joined [11:22] kawaii, $blah = !$blah2? [11:22] (implying I don't know the state of the Bool, I just want to switch it regardless) [11:22] $blah = !$blah? [11:22] ah :D [11:23] wait really [11:23] this is a thing [11:23] sarna: here's the code that was working for me with newlines https://gist.github.com/codesections/445e2a043c4ffe4a4cfbb7aac75d5462 [11:23] Altai-man++ [11:23] *** xinming left [11:24] *** xinming joined [11:25] *** hungrydonkey left [11:26] kawaii: and you don't really need the final `?`, though it might make the expression clearer, at least to some readers [11:26] codesections: trust me, no one is capable of reading anything I write :) [11:27] :D [11:28] codesections: https://repl.it/repls/OnerlookedAngryClimate#main.raku take a look here, without line 8 it works fine [11:31] hmm, odd. I *bet* that's something to do with the precedence/associativity of the operator, but I'm not sure. https://docs.raku.org/language/functions#Precedence [11:35] is there a way of getting the block that called the current block? [11:38] *** JJMerelo left [11:42] SmokeMachine: I assume CALLER doesn't do what you want, because you want the actual _block_ and not a way to look up symbols in that block? [11:46] codesections: it would be... but it doesn't seem to work inside a Proxy's fetch block... :( [11:48] *** hungryd22 joined [11:50] I was trying to do something like this to make rerun every block where the variable was used when it changes it value: [11:50] m: my %blocks is SetHash; my $a := Proxy.new: FETCH => sub fetch(|) { say CALLER; %blocks{CALLER} = True; 42 }, STORE => -> $, | { .() for %blocks.keys }; sub bla { say $a }; bla; $a = 13 [11:50] rakudo-moar 2db92e04f: OUTPUT: «(CALLER)␤Cannot invoke this object (REPR: Uninstantiable; CALLER)␤ in block at line 1␤ in block at line 1␤␤(CALLER)␤(CALLER)␤(CALLER)␤(CALLER)␤(CALLER)␤(CALLER)␤42␤» [11:54] *** hungryd22 left [11:54] *** hungrydonkey joined [12:01] ¦ doc/default-0: 421864a707 | (Stoned Elipot)++ | doc/Type/Baggy.pod6 [12:01] ¦ doc/default-0: Current and explicit Baggy.default signature [12:01] ¦ doc/default-0: review: https://github.com/Raku/doc/commit/421864a707 [12:01] ¦ doc: stoned++ created pull request #3565: Current and explicit Baggy.default signature [12:01] ¦ doc: review: https://github.com/Raku/doc/pull/3565 [12:12] *** aborazmeh left [12:25] Is there a clean way of removing a value from an @array if what we try to `push` already exists? [12:27] why push if it already exists? [12:27] you mean, moving an element to the end? [12:27] *** lichtkind joined [12:28] andinus: because the $end-user doesn't know if it exists or not :) but you're saying I should check first before pushing in my code? [12:28] *** Maylay joined [12:28] I was just wondering if there was some built-in logic [12:28] kawaii: does the order of elements matter? [12:28] nope [12:29] then maybe a Set is the better data structure [12:29] because there adding an element that's already in there is a no-op [12:29] I was thinking Hash [12:30] and checking if an element is in a set is fast, compared to an array [12:30] kawaii: a Set is basically Hash without values [12:30] do you need to store values? [12:30] I don't, so you're probably right about using a Set [12:31] I use hashes a lot in p5, but python has taught me to take sets seriously :D [12:31] and then the SetHash variety, if you want a mutable one [12:32] *** finanalyst left [12:32] lizmat++ good point, forgot that sets are immutable by default [12:32] ah, yes I need to add and remove from it regularly :) [12:35] moritz: `my SetHash[Str] $monitored-channels;`, so once I've defined it, how would I `push` a value here? :) [12:35] It's basically storing just a few hundred strings [12:36] (but by default will be empty) [12:36] my SetHash[Str] $monitored-channels .= new(); $monitored-channels = True; [12:36] https://docs.raku.org/type/SetHash [12:39] https://www.irccloud.com/pastebin/C0xdswFQ/ [12:39] *** stoned75 left [12:39] moritz: hey this is really cool :D [12:39] thanks! [12:40] my pleasure [12:52] *** sena_kun joined [12:53] *** skids joined [12:53] *** Altai-man left [13:03] kawaiiL it you're using a SetHash, you can also use the .set and .unset methods [13:04] m: my %sh is SetHash; %sh.set(1,2,3,4); dd %sh; %sh.unset(2,3); dd %sh [13:04] rakudo-moar 2db92e04f: OUTPUT: «Too many positionals passed; expected 2 arguments but got 5␤ in block at line 1␤␤» [13:04] hmmm [13:04] lizmat: `$monitored-channels{$message.channel-id} = !$monitored-channels{$message.channel-id};` I'm doing it like this to flip between adding and removing based on the user running a command :) [13:04] *** stoned75 joined [13:04] m: my %sh is SetHash; %sh.set((1,2,3,4)); dd %sh; %sh.unset((2,3)); dd %sh [13:04] rakudo-moar 2db92e04f: OUTPUT: «SetHash.new(4,3,1,2)␤SetHash.new(4,1)␤» [13:04] hmmm... I guess that a. needs documentation, and b. another slurpy candidate [13:05] I have documenting that (and BagHash.add) on my to-do list [13:06] codesections: could you create an issue for the above problem> [13:07] m: my $b = True; $b .= not; say $b # kawaii: another way to toggle a boolean without mentioning it twice [13:07] ? [13:07] rakudo-moar 2db92e04f: OUTPUT: «False␤» [13:07] lizmat: will do! [13:07] codesections++ [13:08] tobs: there are too many ways of doing these things, raku has spoiled me :) [13:09] tobs: the only inconsistency there is that $b != $b _looks_ like it should do the same thing, but that means something else entirely :) [13:12] *** aborazmeh joined [13:12] *** aborazmeh left [13:12] *** aborazmeh joined [13:12] yeah, I guess Raku made a concession to the widespread use of != there. [13:13] *** gnufr33dom joined [13:14] agreed. In retrospect (and with the knowledge of how many people will know at least a little JS, with its broken comparitors), I kind of wish we'd gone with `!==` [13:15] codesections: but you can [13:15] m: say 42 !=== 666 [13:15] rakudo-moar 2db92e04f: OUTPUT: «True␤» [13:15] m: say 42 !== 666 [13:15] rakudo-moar 2db92e04f: OUTPUT: «True␤» [13:16] prefix ! is a meta op in that context [13:16] so if you want your code to be more readable in that respect, you can [13:17] Ok, fair point. But I meant that we could have not had `!=` be a comparison operator, which would have freed it up to be the negation operator with assignment [13:17] to keep the parallelism with .= and other assignment meta ops [13:19] =! isn't good enough for you;) [13:21] jdv79: ha, I didn't know you could put the whitespace like that! [13:26] m: sub infix:(\a,\b) { a = !b }; my $a != True; say $a [13:26] rakudo-moar 2db92e04f: OUTPUT: «False␤» [13:27] :D [13:30] for the original task we'd want this to be "prefix mutating unary metaop"-lookalike though [13:30] m: sub prefix:($a is rw) { $a .= not }; my $b = True; say $b; say !=$b; say $b [13:30] rakudo-moar 2db92e04f: OUTPUT: «True␤False␤False␤» [13:35] *** lucasb joined [13:40] lizmat: != and ≠ are roughly the same in performance, !== is much slower [13:41] pretty much any uncommon syntax is several times slower [13:42] How to "redirect" $*ERR to $some-Str for a bit? [13:44] AlexDaniel: nothing a "constant &infix: = &infix:" wouldn't fix [13:45] *** oddp left [13:45] AlexDaniel: only "roughly the same"? I thought they _were_ the same operation [13:45] m: say &infix === &infix<≠> [13:45] rakudo-moar 2db92e04f: OUTPUT: «5===SORRY!5=== Error while compiling ␤Undeclared routine:␤ infix used at line 1. Did you mean 'index', 'indir'?␤␤» [13:46] m: say &infix: === &infix:<≠> [13:46] rakudo-moar 2db92e04f: OUTPUT: «True␤» [13:46] ^ s/for a bit/for more than one bit/ Ha! [13:46] codesections: they are the same [13:46] lizmat: that's probably true [13:47] lizmat: IIRC ≠ required a bit of wiggling to make sure it works right and is fast at the same time, I guess indeed the same can be applied to other ops [13:48] m: dd &infix:<≠>.name # they're aliased [13:48] rakudo-moar 2db92e04f: OUTPUT: «"infix:"␤» [13:49] so there is *no* runtime overhead [13:49] m: my $a = 42; for ^1000000 { my $b := $a != 666 }; say now - INIT now [13:49] rakudo-moar 2db92e04f: OUTPUT: «0.02375516␤» [13:50] m: constant &infix: = &infix:; my $a = 42; for ^1000000 { my $b := $a !== 666 }; say now - INIT now [13:50] rakudo-moar 2db92e04f: OUTPUT: «0.0409685␤» [13:50] m: constant &infix: = &infix:; my $a = 42; for ^1000000 { my $b := $a !== 666 }; say now - INIT now [13:50] rakudo-moar 2db92e04f: OUTPUT: «0.0269728␤» [13:50] m: my $a = 42; for ^1000000 { my $b := $a != 666 }; say now - INIT now [13:50] rakudo-moar 2db92e04f: OUTPUT: «0.024267␤» [13:50] m: my $a = 42; for ^1000000 { my $b := $a != 666 }; say now - INIT now [13:50] rakudo-moar 2db92e04f: OUTPUT: «0.0246294␤» [13:50] m: constant &infix: = &infix:; my $a = 42; for ^1000000 { my $b := $a !== 666 }; say now - INIT now [13:50] rakudo-moar 2db92e04f: OUTPUT: «0.04128212␤» [13:50] not enough iterations and possibly too much stuff optimized away [13:50] yeah, but anyway, in the same ballpark [13:56] Is `note $msg; exit 1` (or other non-zero number) the preferred way to exit a CLI app when printing an error msg to the end user? I thought `die $msg` would be better, but it adds `===SORRY!===`, which the end user doesn't really need to see... [13:56] codesections: that's how I would do it if it was a compile time error and I would want to get rid of the SORRY [13:57] lizmat++ [13:59] (someday, I need to understand Raku's notion of "compile time" better. The error I encountered was based on calling EVALFILE on a file that the user passes in with a CLI flag... and yet that's a compile-time error? I guess because EVALFILE is "compiling" the file before/as it runs it? [13:59] ) [14:00] yup [14:00] yes, compile and run time can be nested in each other [14:00] EVAL/EVALFILE nests a compile time inside run time [14:01] one of the cases of tormenting the implementor :-) [14:01] and BEGIN (and other constructs) nest in a run time during compile time [14:02] rir: I think you would need to wrap a Str inside an IO::Handle like interface and `temp` assign that to $*ERR. There is a module for that: https://github.com/hoelzro/p6-io-string [14:02] *** aborazmeh left [14:02] wow. That's all crazy powerful. But also makes some things a bit harder to reason about. I'm used to thinking of "it's done at compile time" as "it's free at runtime". But I guess that isn't always true with Raku [14:02] (Which might matter as we start doing more compile-time programming with RakuAST) [14:04] codesections: Tanstafl. tobs: Thanks. [14:04] rir: fair [14:09] ¦ doc/baggy-bool-eg: 2ce6a8f169 | (Stoned Elipot)++ | doc/Type/Baggy.pod6 [14:09] ¦ doc/baggy-bool-eg: Fix example output [14:09] ¦ doc/baggy-bool-eg: review: https://github.com/Raku/doc/commit/2ce6a8f169 [14:10] ¦ doc: stoned++ created pull request #3566: Fix example output [14:10] ¦ doc: review: https://github.com/Raku/doc/pull/3566 [14:10] *** sarna left [14:15] *** aborazmeh joined [14:15] *** aborazmeh left [14:15] *** aborazmeh joined [14:16] *** rockxloose left [14:17] *** mtj_ left [14:17] *** MilkmanDan joined [14:18] *** wamba joined [14:19] *** aborazmeh left [14:21] ¦ doc: 2ce6a8f169 | (Stoned Elipot)++ | doc/Type/Baggy.pod6 [14:21] ¦ doc: Fix example output [14:21] ¦ doc: review: https://github.com/Raku/doc/commit/2ce6a8f169 [14:21] ¦ doc: 44df452c0b | (Will Coleda)++ (committed using GitHub Web editor) | doc/Type/Baggy.pod6 [14:21] ¦ doc: Merge pull request #3566 from Raku/baggy-bool-eg [14:21] ¦ doc: [14:21] ¦ doc: Fix example output [14:21] ¦ doc: review: https://github.com/Raku/doc/commit/44df452c0b [14:21] Link: https://docs.raku.org/type/Baggy [14:44] *** guifa joined [14:45] Um, wow. I figured this refactor would be a little bit faster but I wasn’t expeting it to be THAT much faster [14:45] 2020-08-18T21:26:41Z #raku guifa`: Thanks, I'll look at Comma. I've been mired in 'too much to learn' and forgot all about it. [14:45] https://bit.ly/31bSRni [14:46] *** wamba left [14:46] Basically a three order of magnitude speed up. That should let loading of CLDR data be MUCH faster hopefully [15:00] *** gnufr33dom left [15:09] m: my $x = "t"; class T { method t { "T v".say } }; (T."$x").raku.say; [15:09] rakudo-moar 2db92e04f: OUTPUT: «5===SORRY!5=== Error while compiling ␤Quoted method name requires parenthesized arguments. If you meant to concatenate two strings, use '~'.␤at :1␤------> 3ss T { method t { "T v".say } }; (T."$x"7⏏5).raku.say;␤» [15:10] I know that T."$x"() works fine. Is it possible that in the future, raku can return the code for T."$x" kind of syntax? [15:12] I’ve always wondered about that requirement myself [15:14] what do you mean by "return the code for"? [15:15] return the method instead of calling it? [15:15] and, relatedly, why does `T."$x"()` work, but T::("$x") does not? [15:15] T.^lookup($x) [15:15] moritz: I think xinming just meant "restore the functionality to be able to do" [15:15] because methods live in a classes (or roles) method table, not in a scope [15:16] and T::($x) is a lookup in a scope [15:16] codesections: if you want the method object, and not call it, use T.^lookup($x) [15:17] or T.^find_method($x); the two differ a bit when it comes to role and auto punning -- cannot remember which one is better for your use case right now [15:17] yeah, I get all that :). I've been diving pretty deep into these introspection methods [15:17] I'm saying that there's some special casing to get T."$x"() to work [15:18] moritz: what’s the logic in requiring () though for calling? Obviously, normally you just need to do foo.call-method, and not foo.call-method(). It’s seemed odd to me to require the parentheses for the quoted method, though I’m sure there’s a reason [15:18] it has to resolve "$x" into `t`, and then lookup `t` in the T method table [15:19] and it seems like the same special casing could just as easily apply to T::("$x"), and increase consistency by doing so [15:19] guifa: that has to do with producing better error messages for accidentally using . as the concat operator (a common p5ism) [15:19] perlisms strike again lol [15:19] moritz: yes, I do mean return the method object with the specified name. [15:20] hmm, Ignore me, I just realized, that calling method doesn't require the (). [15:21] so, require $obj."$method-name"() is fine. ;-) [15:21] The recent question on SO about adding a sub infix:«>>» keeps reminding me how catering to users from other languages can sometimes prevent fluent Raku users from doing certain things :-) [15:21] on the one hand, I hate that so many p5isms shape current-day raku. OTOH I still use Perl 5 quite a lot, and those error messages often saved my butt [15:21] * guifa . o O ( although why anyone would really WANT to have a >> infix given how it already pulls at least double duty elsewhere… ) [15:25] ¦ doc: 5ff724940a | stoned++ (committed using GitHub Web editor) | doc/Type/Baggy.pod6 [15:25] ¦ doc: Current and explicit Baggy.default signature (#3565) [15:25] ¦ doc: review: https://github.com/Raku/doc/commit/5ff724940a [15:25] Link: https://docs.raku.org/type/Baggy [15:25] Also, random thought: andthen has basically a perfect precedence level [15:25] DOC#3565 [closed]: https://github.com/Raku/doc/pull/3565 Current and explicit Baggy.default signature [15:26] looser than commas so I can still use a colon method call, but tighter than postfix if [15:27] m: say “a”, “b” andthen say “c” if True [15:27] rakudo-moar 2db92e04f: OUTPUT: «ab␤c␤» [15:28] m: say “a”, “b” andthen say “c” if False [15:28] rakudo-moar 2db92e04f: ( no output ) [15:44] *** MilkmanDan left [15:51] *** MilkmanDan joined [15:51] *** melezhik joined [16:01] *** mtj_ joined [16:20] *** dogbert11 joined [16:33] *** dakkar left [16:44] *** gabiruh joined [16:51] *** Altai-man joined [16:53] *** sena_kun left [17:07] I mentioned this the other day, but I *really* like that this form works: [17:08] m: say 1 ==> {$_ + 1}() [17:08] rakudo-moar 2db92e04f: OUTPUT: «1␤» [17:08] m: say: 1 ==> {$_ + 1}() [17:08] rakudo-moar 2db92e04f: ( no output ) [17:09] m: ( 1 ==> {$_ + 1}() ).say [17:09] rakudo-moar 2db92e04f: OUTPUT: «2␤» [17:10] ¦ doc/list-eg-output: 7a0b5821fe | (Stoned Elipot)++ | doc/Type/List.pod6 [17:10] ¦ doc/list-eg-output: Uniformize examples' output [17:10] ¦ doc/list-eg-output: [17:10] ¦ doc/list-eg-output: And while here, if we would like an example to produce an output, [17:10] ¦ doc/list-eg-output: we might as well call `say` :) [17:10] ¦ doc/list-eg-output: review: https://github.com/Raku/doc/commit/7a0b5821fe [17:10] ¦ doc: stoned++ created pull request #3568: Uniformize examples' output [17:10] ¦ doc: review: https://github.com/Raku/doc/pull/3568 [17:10] (grr, getting the output to print correctly there made the syntax less pretty and undermined the point I was making. Oh well) [17:19] *** Kaiepi joined [17:21] m: class B { has $.a is rw; }; class T is B { method t () { $.B::a = 5 }; }; my $o = T.new; $o.t.say; [17:21] rakudo-moar 2db92e04f: OUTPUT: «No such method 'B::a' for invocant of type 'T'␤ in method t at line 1␤ in block at line 1␤␤» [17:21] m: class B { has $.a is rw; }; class T is B { method t () { self.B::a = 5 }; }; my $o = T.new; $o.t.say; [17:21] rakudo-moar 2db92e04f: OUTPUT: «5␤» [17:21] In this case, Should $.B::a work as expected? [17:22] hmm, ignore me, I think I realized, that $.meth is to mean $(self.meth) literally [17:37] m: 1 ==> {say $_ + 1}(); [17:37] rakudo-moar 2db92e04f: OUTPUT: «2␤» [17:37] codesections: Better? Or not what you wanted? [17:38] Meh, close enough :) That's technically printing out the sum of $_ + 1 and then returning True from the block, and I was printing out the return value of the block. But I didn't really care about printing – I just like that we can pass args in from the left when it's clearer to do so! [17:40] *** sftp joined [17:41] wait... it just occurred to me that we can also do 1.&{$_ + 1} [17:44] You win. [17:46] *** stoned75 left [17:48] codesections: you can do `==> say()` too [17:58] *** Guest47135 is now known as aluaces [18:23] *** finanalyst joined [18:23] *** bocaneri left [18:27] *** rindolf left [18:28] Hey, is there a way to limit floats to 2 decimal places when printing? [18:29] Or I guess it's a Num, not a float [18:30] m: say '%.2f'.sprintf(20.sqrt) [18:30] rakudo-moar 2db92e04f: OUTPUT: «4.47␤» [18:30] brass ^^^ [18:31] docs are here: https://docs.raku.org/language/independent-routines#routine_sprintf [18:31] or 20.sqrt.fmt('%.2f') [18:31] Oh awesome, thank you [18:32] tobs: oh, I didn't know about that one. Any idea why we have two such similar subs? Just for TIMTOWTDI? [18:33] pretty sure that fmt uses sprintf internally, but one is a method on (format) Strs, the other on Cool [18:34] makes sense [18:34] depends on what is the subject and what the object of that statement in your head, so yes TIMTOWTDI [18:35] *** rindolf joined [18:42] *** xelxebar joined [18:49] *** cpan-raku joined [18:49] *** cpan-raku left [18:49] *** cpan-raku joined [18:53] *** wamba joined [18:55] *** melezhik left [19:05] *** guifa` joined [19:13] *** wamba left [19:35] <[Coke]> m: dd FatRat.^methods[*-1] [19:35] rakudo-moar 2db92e04f: OUTPUT: «Submethod+{is-hidden-from-backtrace} BUILDALL = Submethod+{is-hidden-from-backtrace}.new␤» [19:37] Is it allowed to wrap `when` in `if` within switches like this? https://www.irccloud.com/pastebin/jbKPVgPn/ [19:43] is there a way of changing the default class for @, % and $ on a specific class or on a class created by a specific metaclass? [19:44] I mean on attributes [19:44] *** melezhik joined [19:46] kawaii: it appears to work okay [19:47] guifa`: thanks for testing, not on my raku box :) [19:48] kawaii If you've gome complex logic though, you can always use given $blah, $something [19:48] and then [19:49] when 1, .not { }; when 2, .not { }, when 3, * { } [19:57] *** melezhik left [20:03] Is it intentional that when I run something like &print.^methods I get completely borked output? [20:04] I get a ton of lines mixed in with the methods that just say "implementation detail and has no serviceable parts inside" and it makes the output unreadable [20:07] Like this https://imgur.com/WaI2SZO [20:11] Like I can use something like `&print.^methods.grep(!*.gist.contains(" "))' but that seems unnecessary [20:12] brass: what are you trying to achieve? [20:12] <[Coke]> when you dump them methods, you're getting a gist of the methods, not the method names. [20:12] I just like checking out the methods on random things out of curiosity [20:12] Ah ok I see [20:13] <[Coke]> m: &print.^methods>>.name [20:13] rakudo-moar 2db92e04f: ( no output ) [20:13] m: say &print.^methods».name [20:13] rakudo-moar 2db92e04f: OUTPUT: «( gist multi leave soft package wrap unwrap onlystar raku cando candidates BUILDALL POSITIONS phasers returns WH…» [20:13] <[Coke]> m: dd &print.^methods>>.name [20:13] rakudo-moar 2db92e04f: OUTPUT: «("", "leave", "", "", "", "", "", "raku", "", "", "soft", "", "cando", "", "package", "gist", "", "onlystar", "", "", "multi", "", "", "", "", "wrap"…» [20:13] ha :) [20:13] <[Coke]> so that's a little better. [20:13] * [Coke] shakes his old-man fist in the air. [20:13] <[Coke]> <-- too slow [20:14] Haha [20:14] * tadzik has the ping advantage [20:14] What are the anonymous methods use for? [20:14] * [Coke] is also theoretically supposed to be paying attention to this presentation [20:14] <[Coke]> m: dd &print.^methods[0] [20:14] rakudo-moar 2db92e04f: OUTPUT: «ForeignCode = The 'ForeignCode' class is a Rakudo-specific␤implementation detail and has no serviceable parts inside␤» [20:15] <[Coke]> m: dd &print.^methods[2] [20:15] rakudo-moar 2db92e04f: OUTPUT: «ForeignCode = The 'ForeignCode' class is a Rakudo-specific␤implementation detail and has no serviceable parts inside␤» [20:15] <[Coke]> m: dd &print.^methods[3] [20:15] rakudo-moar 2db92e04f: OUTPUT: «Method gist = proto method gist (Mu: |) {*}␤» [20:15] <[Coke]> m: dd &print.^methods[2].Signature [20:15] rakudo-moar 2db92e04f: OUTPUT: «No such method 'Signature' for invocant of type 'ForeignCode'. Did you␤mean 'signature'?␤ in block at line 1␤␤» [20:15] <[Coke]> m: dd &print.^methods[2].signature [20:15] rakudo-moar 2db92e04f: OUTPUT: «:(|)␤» [20:15] what a weird smiley face [20:16] <[Coke]> so you can poke around at the individual methods a bit if you want. [20:16] <[Coke]> tadzik++ [20:20] *** MasterDuke joined [20:33] *** Kaiepi left [20:36] how can I do something like this (but that works) [20:36] m: class P is Proxy { has $!value; method new { ::?CLASS.bless: FETCH => -> | { $!value }, STORE => -> $value { $!value = $value } } }; my $p := P.new [20:36] rakudo-moar 2db92e04f: OUTPUT: «Cannot invoke this object (REPR: Null; VMNull)␤ in method new at line 1␤ in block at line 1␤␤» [20:39] SmokeMachine: fwiw, I haven't been able to subclass Proxy :-( [20:40] *** stoned75 joined [20:40] lizmat: :( [20:40] I think that's not the first time I do that question... [20:42] perhaps this is of use: https://gist.github.com/lizmat/4bb3e1d997f9e6a84256d985815a431d [20:43] hi it seems the independent routine join's first parameter has a default value, how can I trigger its usage ? [20:43] cf. https://github.com/rakudo/rakudo/blob/master/src/core.c/Any-iterable-methods.pm6#L2146 [20:44] interesting: I don't think you can, and it's there for documentation / introspection only [20:45] https://gist.github.com/lizmat/4bb3e1d997f9e6a84256d985815a431d # for SmokeMachine [20:45] that's what I thought but I don't get how it is useful [20:46] it could be considered dead code [20:46] ok :) [20:51] Hello, I'm working a module that is doing some native calls and I have a Pointer[int32] that I'm trying to get the int value out of. my $p = Pointer[int32].new(); # Native call that assigns the value say $p.deref; This causes a segfault. What am I missing? If I say $p I can see the value is visible NativeCall::Types::Pointer[int32]<0x2> [20:51] *** thundergnat joined [20:52] *** sena_kun joined [20:53] ¦ doc: taboege assigned to codesections Issue Document the .add/.remove BagHash methods and the .set/.unset SetHash methods https://github.com/Raku/doc/issues/3569 [20:53] m: say join' [20:53] rakudo-moar 2db92e04f: OUTPUT: «5===SORRY!5=== Error while compiling ␤Two terms in a row␤at :1␤------> 3say join7⏏5'␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ statement modifier␤ …» [20:54] m: say join [20:54] rakudo-moar 2db92e04f: OUTPUT: «␤» [20:54] *** Altai-man left [20:54] stoned75: the reason $sep = '' is in there [20:54] without it, the above would throw an error [20:56] so a straigth join a is fancy way to get an empty string ? :) [20:56] yeah, looks like :-) [20:57] Oh I think I realized part my the problem. I wasn't aware native CPointers don't allocate memory. how would I do that for an Pointer[int32]? [20:58] lizmat: but I still need to pass FETCH and STORE, right? :( [20:58] This fills me with nearly equal parts pleasure and horror: https://gist.github.com/thundergnat/76b406a52ed92a3478d008a99b80715a [20:59] I'm debating whether that is worth packaging up and releasing as a module. [20:59] SmokeMachine: don't think so [20:59] *** rindolf left [20:59] as long as the Proxy is set up the correct way and returned, it shouldn't matter [20:59] no, you are right... I haven't removed the !s [21:01] thundergnat: I seem to recall this is being done for 1,2,4 bit native ints on MoarVM [21:01] or: work is underway to do that [21:01] lizmat: but can I use positional inside the FETCH block? [21:02] I am somewhat amused that mine will support ANY sized UInt. Want a 23 bit UInt? No problem. :-) [21:02] SmokeMachine [21:02] SmokeMachine: not sure what you mean [21:03] thundergnat: 1,2,4 native bit support would also imply native arrays with those sizes [21:03] primetoxinz: i haven't used NativeCall, but i'd suggest asking timotimo or nine, they should be able to help [21:04] MasterDuke: thanks [21:07] lizmat: I what to have a attribute on the proxy's child and use it inside the FETCH and STORE blocks [21:08] what an attribute? Shouldn't a closed over variable have the same functionality ? [21:09] *why [21:09] *** sftp left [21:09] lizmat: to store the value [21:11] lizmat: what I'm trying to do is a "Scalar" that does something on FETCHing and on STOREing besides everything Scalar already do [21:11] SmokeMachine: have you read https://raku-advent.blog/2020/08/17/rfc-159-by-nathan-wiger-true-polymorphic-objects/ ? [21:12] in the "proxier" sub, the $value parameter is closed over and acts as an attribute, no ? [21:13] lizmat: you mean storing it on a local var? that makes sense... [21:13] inside the sub you can as many as you want [21:13] *the proxier sub [21:14] lizmat: yes, thank you very much! [21:16] *** sftp joined [21:18] lizmat: about that, is there a way to change the default Class for @, % and $ on a class being created by a custom meta class? [21:18] without need to do `has @.bla is MyNewDefault` [21:18] actually, I ran into that recently myself [21:19] lizmat: and have you found a way of doing that? [21:19] :) [21:20] m: BEGIN say Array.WHERE; class Array is Array { }; BEGIN say Array.WHERE [21:20] rakudo-moar 2db92e04f: OUTPUT: «66032432␤139810078667168␤» [21:20] so that establishes that you *can* subclass Array lexically with same name [21:21] m: BEGIN say Array.WHERE; class Array is Array { method what { say "Im not array" } }; BEGIN say Array.WHERE; Array.what [21:21] rakudo-moar 2db92e04f: OUTPUT: «52253584␤139954543880224␤Im not array␤» [21:21] m: class Array is Array { method AT-POS($pos) { say "fetching $pos"; nextsame } }; my @a is Array = ^10; say @a[2] [21:21] rakudo-moar 2db92e04f: OUTPUT: «fetching 2␤2␤» [21:21] interesting... [21:21] so, the codegen is *not* looking at what Array means when it is compiling [21:22] I would consider that a bug, actually [21:22] m: BEGIN say Scalar.WHERE; class Scalar is Scalar { method what { say "Im not scalar" } }; BEGIN say Scalar.WHERE; Scalar.what; my $a; $a.VAR.what [21:22] rakudo-moar 2db92e04f: OUTPUT: «62009056␤No such method 'what' for invocant of type 'Any'. Did you mean 'flat'?␤ in block at line 1␤␤140267424113536␤Im not scalar␤» [21:24] lizmat: it really seems to be a bug, but that should be a way to change the default, shouldn't it? [21:24] I would say so, yes, at least lexically [21:26] lizmat: I was thinking on something like existing a method on the meta class that returns the default, like: sub default-class-for(\type, Positional) { Array } [21:27] that feels like a lot of action-at-a-distance to me [21:27] class Array is Array { } would at least only be active in the scope where the "subclass" exists [21:27] lizmat: that way I could implement a meta class that would use different defaults than ClassHOW [21:28] sure... :-) [21:29] that way it would affect only the types created by that meta class... but if you are using that new keyword for using that meta class, you want the new default [21:29] lizmat: why would be that action-at-a-distance? [21:29] isn't the meta class responsible to define everything about the new type? [21:30] if you're creating a new meta-class, that's ok [21:30] I was referring to adding that default-class-for( to the current meta-class [21:30] lizmat: yes, that's my intention [21:30] m: say Version.new("1.2.1") cmp Version.new("1.2.1γ") [21:30] rakudo-moar 2db92e04f: OUTPUT: «More␤» [21:31] 2020-08-17T22:48:26Z #raku tony-o - here the list of aws related sparrow plugins, including the ones to work with lambdas - http://rakudist.raku.org/hub/search?q=aws [21:31] 2020-08-17T22:52:39Z #raku tony-o some of aws plugins might now work as they were created for old version of Sparrow written in Perl, but these ones (lambda related) should work - http://rakudist.raku.org/hub/search?q=function [21:31] 2020-08-17T23:05:28Z #raku tony-o - might NOT work [21:31] and *that* would affect classes outside of the lexical scope where you wet a different default class, would it not ? [21:31] lizmat: but would be a way of new meta classes use a method to define the defaults and ClassHOW do not implement that? [21:32] I'm not sure I can parse that line in the way you meant [21:32] sorry, my english is terrible [21:33] no pb, please try to explain again :-) [21:33] I mean, if ClassHOW has a `default-class-for`, every type created by that would use that defaults, right? [21:35] yes [21:35] when creating the type, when find an attribute with @, for example, it would run `type.^default-class-for(Positional)` it would return Array and that type would have a new Array attribute [21:36] the only way of changing the defaults would be creating a new meta class. [21:36] ah, so you mean that would not be settable ? [21:36] I got the impression from you that it would be settable [21:36] yes, read only [21:36] no... [21:37] sure, that could work :-) [21:37] do you think people would accept something like that? [21:37] ¦ doc/list-join: cb606ae8f3 | (Stoned Elipot)++ | doc/Type/List.pod6 [21:37] ¦ doc/list-join: Rework List.join examples and description [21:37] ¦ doc/list-join: [21:37] ¦ doc/list-join: - Remove duplicate note about the optional separator for the method form [21:37] ¦ doc/list-join: - It's the subroutine form that is slurpy and flattening [21:37] ¦ doc/list-join: - Group related examples [21:37] ¦ doc/list-join: - Correct a typo [21:37] ¦ doc/list-join: review: https://github.com/Raku/doc/commit/cb606ae8f3 [21:37] ¦ doc: stoned++ created pull request #3570: Rework List.join examples and description [21:37] ¦ doc: review: https://github.com/Raku/doc/pull/3570 [21:38] SmokeMachine: I would give it a good chance :-) [21:38] * guifa` just got a drawing tablet at $day-job [21:38] Time to make some fancy »ö« [21:39] lizmat: so, I think I'll create a new problem solving issue... [21:39] ++SmokeMachine [21:40] ¦ doc: codesections++ created pull request #3571: Overhaul the list-missing-methods.p6 script [21:40] ¦ doc: review: https://github.com/Raku/doc/pull/3571 [22:04] *** wamba joined [22:11] m: say say Version.new("γ") cmp Version.new("0"); say "γ" cmp "0"; [22:11] rakudo-moar 2db92e04f: OUTPUT: «Less␤True␤More␤» [22:11] m: say Version.new("γ") cmp Version.new("0"); say "γ" cmp "0"; [22:11] rakudo-moar 2db92e04f: OUTPUT: «Less␤More␤» [22:17] *** sftp left [22:25] *** guifa` left [22:28] *** japhb joined [22:28] *** sftp joined [22:30] *** yuplushi joined [22:31] *** stoned75 left [22:36] *** squashable6 joined [22:50] *** sena_kun left [22:51] *** sena_kun joined [22:57] *** Sgeo joined [23:04] *** hungrydonkey left [23:07] *** guifa` joined [23:08] *** lichtkind left [23:25] *** wamba left [23:37] *** aborazmeh joined [23:37] *** aborazmeh left [23:37] *** aborazmeh joined [23:39] *** MilkmanDan left [23:39] *** MilkmanDan joined [23:42] *** aborazmeh left [23:46] lizmat: https://github.com/Raku/problem-solving/issues/220 [23:48] *** aborazmeh joined [23:48] *** aborazmeh left [23:48] *** aborazmeh joined