🦋 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:24 teatime joined, lichtkind_ left 00:29 jpn joined 00:38 jpn left 00:54 sdomi left 00:55 sdomi joined 00:59 itaipu left 01:13 itaipu joined 01:48 jpn joined 01:53 jpn left 02:45 kylese left 02:46 kylese joined 02:56 swaggboi left 03:01 jpn joined 03:02 swaggboi joined 03:06 jpn left 03:15 kylese left, kylese joined 03:46 jpn joined 03:54 jpn left 05:37 jpn joined 05:42 jpn left 06:32 jpn joined 06:37 jpn left 06:56 jpn joined 07:05 jpn left 07:08 Sgeo_ joined 07:11 Sgeo left 07:41 jpn joined 07:46 jpn left 07:55 jpn joined 08:00 jpn left 08:47 jpn joined 08:49 abraxxa joined 08:53 jpn left 08:56 Sgeo_ left 09:15 abraxxa left 09:16 abraxxa joined 09:18 lichtkind_ joined 09:45 jpn joined 09:53 jpn left 10:01 jpn joined 10:14 jpn left 10:24 jpn joined 10:44 sena_kun joined 11:48 foo63 joined 11:51 lichtkind__ joined 11:55 lichtkind_ left 12:42 jpn left
lizmat And yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2023/12/04/2023-...g-this-ad/ 13:05
sjn lizmat++ 13:36
13:38 jpn joined 13:44 gabiruh left 13:52 gabiruh joined
librasteve o/ 14:39
hello - I have a question about name lookup ... this works vvv 14:41
m: class C::X { has $.y=42 }; role R[$x='X'] {method new {C::X.new}}; dd R.new;
evalable6 C::X.new(y => 42)
Raku eval C::X.new(y => 42)
librasteve (phew, it worked) 14:42
but this fails vvv
m: class C::X { has $.y=42 }; role R[$x='X'] {method new {C::($x).new}}; dd R.new;
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Combination of indirect name lookup and call not supported at /home/glot/main.raku:1 ------> 2 }; role R[$x='X'] {method new {C::($x)⏏.new}}; dd R.new; expecting any of: argument list
evalable6 (exit code 1) 4===SORRY!4=== Er…
librasteve, Full output: gist.github.com/3a4d697ba1dc1f30fc...a74af2d502
librasteve what I am doing wrong?
oh - I have worked it out... vvv 14:48
m: class C::X { has $.y=42 }; my $x= 'X'; dd C::{$x}.new;
evalable6 C::X.new(y => 42)
Raku eval C::X.new(y => 42)
nemokosch yeppers
m: class C::X { has $.y=42 }; role R[$x='X'] {method new {C::{$x}.new}}; dd R.new;
evalable6 C::X.new(y => 42)
Raku eval C::X.new(y => 42)
librasteve thanks! 14:49
wonder what happens if I use ≪≫ [oh so funny joke] 14:50
nemokosch not sure if we want to see that 14:55
oh right, somebody said that %hash<<$key>> would be an allomorph-based lookup. Fortunately that's not the case. The base implementation coerces the key into the exact Str type 14:57
one would wonder what happens for an "object hash" 14:58
m: my %demo{Any}; %demo<12> = 5; %demo.keys.&dd; %demo{12} = 99; dd %demo; 14:59
evalable6 (IntStr.new(12, "12"),).Seq
Hash[Any,Any] %demo = (my Any %{Any} = IntStr.new(12, "12") => 5, 12 => 99)
Raku eval (IntStr.new(12, "12"),).Seq Hash[Any,Any %demo = (my Any %{Any} = IntStr.new(12, "12") => 5, 12 => 99)
nemokosch this one does do allomorph-based lookups, even with the single angular brackets 15:00
looking at the behavior, I rest my case, honestly
librasteve m: my %demo{Any}; %demo≪12≫ = 5; %demo.keys.&dd; %demo{12} = 99; dd %demo; 15:01
evalable6 (exit code 1) 4===SORRY!4=== Er…
librasteve, Full output: gist.github.com/3f6e0c21c009b8fa02...61a9bd3754
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Bogus postfix at /home/glot/main.raku:1 ------> my %demo{Any}; %demo⏏≪12≫ = 5; %demo.keys.&dd; %demo{12} = 99 expecting any of: infix infix stopper statement end statement modifier statement modifier loop 15:02
nemokosch m: my %demo{Any}; %demo<<12>> = 5; %demo.keys.&dd; %demo{12} = 99; dd %demo; 15:04
evalable6 (IntStr.new(12, "12"),).Seq
Hash[Any,Any] %demo = (my Any %{Any} = 12 => 99, IntStr.new(12, "12") => 5)
Raku eval (IntStr.new(12, "12"),).Seq Hash[Any,Any %demo = (my Any %{Any} = IntStr.new(12, "12") => 5, 12 => 99)
nemokosch it probably wasn't the one
librasteve maybe Discord is manlging my unicode 15:05
anyway, all rakoons should know that angle brackets autoquote stringy literals and make allomorphs out of numeric literals, right? 15:07
when you know that the hash behaviour you illustrate is self evident (just putting two familiar things together) 15:08
(or would you rather have different behaviour for angle brackets when used for associative indices?) 15:09
you certainly haven't said anything yet that will make me think removing allomorphs from raku is a good idea 15:10
;-)
nemokosch it seems like you would reject any sort of evidence 15:11
I don't find it a healthy attitude to always just say to whatever that can cause problems more often than not that one can just learn them and then suddenly it's all fine... 15:13
echo chamber stuff
15:19 jpn left 15:28 jpn joined 17:05 euandreh joined 18:24 edr joined 18:30 melezhik joined
melezhik o/ 18:30
if there is a way to dump sub signature in a nice way? like Data::Dumper does? 18:31
m: my &f = sub (Int $s ) { say $s }; say &f.signature;
camelia (Int $s)
melezhik m: my &f = sub (Int :$s ) { say $s }; say &f.signature;
camelia (Int :$s)
[Coke] m: my &f = sub (Int :$s ) { say $s }; dd &f.signature; 18:32
camelia :(Int :$s)
[Coke] dd is the rakudo specific data dumper
MasterDuke m: my &f = sub (Int :$s ) { say $s }; dd &f;
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say $s }; say &f.signature;
camelia Sub &f = sub (Int :$s) { #`(Sub|2506422275968) ... }
===SORRY!=== Error while compiling <tmp>
Variable '$s' is not declared. Perhaps you forgot a 'sub' if this was
intended to be part of a signature?
at <tmp>:1
------> p, Any :$getters_count_limit))  ) { say ⏏$s }; say &f.signat…
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  }; say &f.signature; 18:33
camelia (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit)))
melezhik so I have quite complex signature and I would like to dump them with new lines around nested hashes / etc
m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  }; say dd(&f.signature); 18:34
camelia :(:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit)))
Nil
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  }; say dd(&f);
camelia Sub &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))) { #`(Sub|4214510647424) ... }
Nil
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  }; say dd(&f.signature);
camelia :(:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit)))
Nil
[Coke] If you want a pretty printer, you'll have to write one.
melezhik yeah, that's the point, I thought the maybe already exists, no biggies though
[Coke] m: my &f = sub (Int :$s ) { say $s }; dd &f.signature.^attributes; 18:35
camelia (Attribute.new, Attribute.new, Attribute.new, Attribute.new, Attribute.new, Attribute.new)
[Coke] m: my &f = sub (Int :$s ) { say $s }; dd &f.signature.params
camelia (Int :$s,)
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  }; say dd(&f.signature.params);
camelia (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit)),)
Nil
[Coke] Should be able to introspect all of that. 18:36
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  };  for &f.signature.params.^attributes -> $a { say $a.perl } );
camelia ===SORRY!=== Error while compiling <tmp>
Unexpected closing bracket
at <tmp>:1
------> arams.^attributes -> $a { say $a.perl } ⏏);
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  };  for &f.signature.params.^attributes -> $a { say $a.perl } ;
camelia Attribute.new
Attribute.new
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  };  for &f.signature.params.^attributes -> $a { say $a.Str } ;
camelia $!reified
$!todo
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  };  for &f.signature.params.^attributes -> $a { say $a } ; 18:37
camelia Mu $!reified
Mu $!todo
melezhik reified and todo - quite unexpected output, huh? 🤔 )))
m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  };  for &f.signature.params -> $a { say $a } ;
camelia :%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  };  for &f.signature.params -> $a { say $a, "\n" } ; 18:38
camelia :%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  };  for &f.signature.params<> -> $a { say $a, "\n" } ;
camelia :%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))
melezhik m: my &f = sub (:%params (:%i18n (Any :$path), :%server_params (Any :$notification_objects_page_size, Any :$calendars_count_max, Any :$empty_tag_throttling_sleep, Any :$getters_count_limit))  ) { say 1000  };  for &f.signature.params.^attributes -> $a { say $a.gist } ;
camelia Mu $!reified
Mu $!todo
lizmat melezhik: you know you can also do private messages to camelia? 18:40
melezhik liz ? 18:41
you mean, another eval bot ? 18:42
camelia: say 1000; 18:43
18:49 melezhik left
lizmat no, do m: say "foo" in a private message to camelia 18:51
[Coke] you're generating a lot of backscroll by using public messages. 18:54
I will often do a bunch of stuff in private and then showcase one or two in public
19:17 euandreh left 19:19 euandreh joined 19:23 rba_ joined, meooow_ joined, kaskal- joined 19:24 jcallen joined 19:25 melezhik joined, gfldex_ joined, lesihctej joined, rypervenche_ joined, rba left, rba_ is now known as rba, meooow left 19:26 gfldex left, jetchisel left, jjatria left, kaskal left, edr left, jcallen_ left, rypervenche left, rba_ is now known as rba
melezhik Ahh, ok. I see. I never thought this is gonna be a issue , I see people do that all time here, I thought this is how others see the thoughts flow ))) anyways I will try to be considering ... 19:27
19:31 jpn left 19:33 melezhik left 19:36 jjatria joined 19:49 jpn joined 20:11 melezhik joined 20:14 melezhik left 20:34 TieUpYourCamel left 20:49 TieUpYourCamel joined 21:11 jpn left
[Coke] Appreciate it, and we aren't trying to single you out. 21:32
21:45 lucerne left, jpn joined 21:50 jpn left 21:55 lucerne joined 22:06 jpn joined 22:15 foo63 left 22:19 euandreh left 22:24 jpn left 22:26 euandreh joined 22:30 euandreh left 22:33 euandreh joined 22:42 abraxxa left 22:43 japhb left 22:56 japhb joined 23:00 habere-et-disper joined, euandreh left
mort does raku grammars have a way of dealing with comments nicely? 23:28
I'd want to extend the concept of "whitespace" to include anything between '//' and the end of a line
23:30 Sgeo joined
mort ah I guess you define your own ws token 23:36
23:41 jpn joined 23:47 jpn left 23:48 sena_kun left