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.
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.
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
Xliff_ lismat: OMG... HAH! Thanks. 22:40