Re: regex objects as hash keys

2020-04-06 Thread Joseph Brenner
> Object hashes currently come with a performance penalty. That's why they are > currently not the default. Thanks, that makes sense. On 4/6/20, Elizabeth Mattijsen wrote: >> On 6 Apr 2020, at 07:19, Joseph Brenner wrote: >>> If you want a Hash which allows any >> kind of object as key, you

Re: regex objects as hash keys

2020-04-06 Thread Elizabeth Mattijsen
> On 6 Apr 2020, at 07:19, Joseph Brenner wrote: >> If you want a Hash which allows any > kind of object as key, you have to declare it such: > >> my $obj = Rutabaga.new; >> my %vegeout{Any}; # <-- see: >> https://docs.raku.org/language/hashmap#Non-string_keys_(object_hash) > > That's an inte

Re: regex objects as hash keys

2020-04-05 Thread Joseph Brenner
> If you want a Hash which allows any kind of object as key, you have to declare it such: > my $obj = Rutabaga.new; > my %vegeout{Any}; # <-- see: > https://docs.raku.org/language/hashmap#Non-string_keys_(object_hash) That's an interesting detail, I didn't get that that behavior wasn't the d

Re: regex objects as hash keys

2020-04-05 Thread Tobias Boege
On Sun, 05 Apr 2020, Joseph Brenner wrote: > I find in Raku that (as expected) I can use an object as a hash key: > > class Rutabaga { method color { say "purple (and white)"; } } > > my $obj = Rutabaga.new > my %vegeout; > %vegeout{ $obj } = "this works"; > > And for something I