🦋 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:01 MasterDuke joined 01:08 hulk joined 01:09 kylese left 02:10 jgaz left 02:15 hulk left, kylese joined 03:11 guifa left 03:54 Chanakan left 04:00 Chanakan joined 05:01 Sgeo left
patrickb I seem to recall there was a (now unmaintained PSGI stack for Raku. 05:13
05:19 Sgeo joined 05:30 Sgeo left 08:11 modula joined, defaultxr left 10:25 guifa joined 10:26 guifa left 12:13 MasterDuke left
antononcube Maybe someone should do a design or motivational document for "Raku SGI" similar to this one: metacpan.org/dist/PSGI/view/PSGI/FAQ.pod 12:41
ugexe raku.land/cpan:HANENKAMP/Smack was an experiment with something more raku-specific 12:47
antononcube 👍 12:55
13:10 jgaz joined 13:32 vrurg_ joined 13:34 vrurg left 13:55 Xliff_ joined
Xliff_ \o 13:55
Good morning! I'm trying to port some Javascript that wants to use a Map with object keys. I thought this would work, but it doesn't...
m: class A { }; my $c = Hash[A, Mu].new; my $aa := A.new; my $bb = A.new; $c{$aa} = 1; $c{$bb} = 2; $c.gist.say; $c.keys.map( *.^name ).gist.say
camelia Type check failed in assignment to ; expected A but got Int (1)
in block <unit> at <tmp> line 1
Xliff_ m: class A { }; my $c = Hash[A, Mu].new; my $aa = A.new; my $bb = A.new; $c{$aa} = 1; $c{$bb} = 2; $c.gist.say; $c.keys.map( *.^name ).gist.say
camelia Type check failed in assignment to ; expected A but got Int (1)
in block <unit> at <tmp> line 1
Xliff_ I'm a little concerned about the "assignment to ;". Can someone help? 13:56
Odd... this does! 13:58
m: class A { has $.a }; my $c = Hash[Mu, Mu].new; my $aa := A.new( a => 42 ); my $bb = A.new( a => 23 ); $c{$aa} = 1; $c{$bb} = 2; $c.gist.say; $c.keys.map( *.a ).gist.say
camelia {A.new(a => 42) => 1, A.new(a => 23) => 2}
(23 42)
14:41 Sgeo joined
ugexe m: class A { }; my %c{A}; my $aa := A.new; my $bb = A.new; %c{$aa} = 1; %c{$bb} = 2; %c.gist.say; %c.keys.map( *.^name ).gist.say 16:27
camelia {A.new => 2, A.new => 1}
(A A)
ugexe m: class A { }; my $c = Hash[Mu, A].new; my $aa := A.new; my $bb = A.new; $c{$aa} = 1; $c{$bb} = 2; $c.gist.say; $c.keys.map( *.^name ).gist.say; $c{1} = 1 16:28
camelia {A.new => 2, A.new => 1}
Type check failed in binding to parameter 'key'; expected A but got Int (1)
in block <unit> at <tmp> line 1

(A A)
ugexe m: raku -e 'class A { }; my $c = Hash[Mu, A].new; my $aa := A.new; my $bb = A.new; $c{$aa} = 1; $c{$bb} = 2; $c.gist.say; $c.keys.map( *.^name ).gist.say 16:29
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> raku -e⏏ 'class A { }; my $c = Hash[Mu, A].new;
expecting any of:
infix
infix stopper
postfix
statement …
ugexe m: class A { }; my $c = Hash[Mu, A].new; my $aa := A.new; my $bb = A.new; $c{$aa} = 1; $c{$bb} = 2; $c.gist.say; $c.keys.map( *.^name ).gist.say
camelia {A.new => 2, A.new => 1}
(A A)
ugexe anyway you can do `my Hash %c{A}` or you need to reverse the parameters to Hash i.e. Hash[Mu, A] instead of Hash[A, Mu]
17:04 wayland joined, wayland76 left
Xliff_ ugexe: Thanks... so it has to be '$' sigil'd and Hash[<val>, <key>] ? 17:11
17:18 skyesoss joined
ugexe my %c{A}; %c{$a} = 1; or my $c = Hash[valType, keyType].new 18:24
18:43 simcop2387 left, perlbot left 19:00 simcop2387 joined 19:01 perlbot joined 20:41 sena_kun joined 20:54 simcop2387 left, perlbot left 20:56 simcop2387 joined 20:57 perlbot joined 21:09 jgaz left 21:32 skyesoss left 21:33 skyesoss joined 21:42 sena_kun left 22:58 guifa joined 23:55 skyesoss left