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


If I construct a Pair whose key is a Scalar object, then the identity of
that key object is not properly reflected in the .WHICH value of the Pair:

> my $a = 3; my $b = Pair.new($a.VAR, "z"); say $b.WHICH; $a = 5; say $b.WHICH
Pair|Int|3|Str|z
Pair|Int|5|Str|z

As you can see, the Pair.WHICH method is looking at the value inside the
Scalar container.  As a result, the .WHICH value of the single Pair object
is changing over time, which should never happen.  Pair.WHICH should be
looking only at the identity of the Scalar itself.  The correct .WHICH
string would be something like "Pair|Scalar|47948211032816|Str|z".
I believe the fix is for Pair.WHICH to apply .VAR to $!key.

-zefram

Reply via email to