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


Hi,

As discussed a bit on IRC from 
https://irclog.perlgeek.de/perl6/2016-07-14#i_12840543 until about 
https://irclog.perlgeek.de/perl6/2016-07-14#i_12840653

In a hash that accepts arbitrary objects as keys, an assignment using a 
list-like variable as a key works, but a binding interprets the list nature of 
the variable as a hash slice and fails:

17:02 < lizmat> m: my %h{Any}; my $key = slip("a",); %h{$key} = 1; dd %h   # if 
this works
17:02 <+camelia> rakudo-moar 527f8d: OUTPUT«Hash[Any,Any] %h = (my Any %{Any} = 
(slip("a",)) => 1)␤»
17:02 < lizmat> m: my %h{Any}; my $key = slip("a",); %h{$key} := 1; dd %h   # 
then this should work as well
17:02 <+camelia> rakudo-moar 527f8d: OUTPUT«Cannot bind to Hash[Any,Any] slice␤ 
 in block <unit> at <tmp> line 1␤␤»

As noted there, I'd be perfectly fine with a "make the assignment treat it as a 
slice too, then rethink your program and don't use lists as keys" resolution, 
but right now the behavior is inconsistent.

Thanks for developing Perl 6 so far that the problems that need to be reported 
are as hairy and obscure as this one! :)

G'luck,
Peter

Reply via email to