# New Ticket Created by  Elizabeth Mattijsen 
# Please include the string:  [perl #118479]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118479 >


<lizmat>         r: class A {}; my %h=A.new => 1; say %h; my %h2{Str}=A.new => 
1; say %h2  # feels to me either both should fail, or both should work
[14:25:12] <+camelia>    rakudo b2072f: OUTPUT«("A<-465252350>" => 
1).hash␤Nominal type check failed for parameter 'key'; expected Str but got A 
instead␤  in method STORE_AT_KEY at src/gen/CORE.setting:7122␤  in method STORE 
at src/gen/CORE.setting:7018␤  in block  at /tmp/Au8hPaHP4v:1␤␤»

So either STORE_AT_KEY for typed hashes should stringify objects silently if 
the keytype is Str, like untyped hashes do.  Or untyped hashes should *not* 
automatically stringify objects.


Although the latter seems to be a step away from the behaviour of Perl 5, it 
feels more logical in the Perl 6 context to me.

Maybe this should become a spec issue.



Liz

Reply via email to