Welcome the channel on the development of Cro, a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all the Raku Programming Language has to offer (cro.services). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
09:37 sena_kun joined 09:51 sena_kun left 09:52 sena_kun joined 12:15 sena_kun left 12:18 sena_kun joined 13:23 sena_kun left 13:24 sena_kun joined 15:33 sena_kun left 16:03 sena_kun joined 19:06 xinming joined 19:07 xinming left 19:09 xinming joined 20:49 Xliff joined
Xliff \o 20:49
Has anyone seen a Hash class with a default value? 20:50
So if a key doesn't exist, instead of NIl, it returns something else?
Could someone poke some holes in this? 20:54
m: my %hash; role HashDefault[\T] { method AT-KEY (\k) { callwith(k) // T }; }; class C { }; %hash does HashDefault[C]; %hash<a> = 1; %hash<a>.say; %hash<b>.say; %hash.^name.say
Oops. Wrong channel. Sorry.
21:58 sena_kun left
lizmat m: my %h is default(42); dd %h<a> # Xliff 22:22
my %h is default(42); dd %h<a>'
Int %h{'a'} = 42
22:40 Xliff_ joined
Xliff_ lismat: OMG... HAH! Thanks. 22:40