# New Ticket Created by Zefram # Please include the string: [perl #128934] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=128934 >
> my $n = { my class Num {} }().new; my $m = $n.WHICH.Str.split("|")[1].Num; > for $n, $m { say (.WHICH, .^methods.elems) } (Num|47923715919504 0) (Num|47923715919504 63) I have here two distinct objects, of different classes, with the same .WHICH string. One is an instance of an empty class I've just defined, and the other is a floating-point value in a built-in class. In the above you can see that they really are of these two different classes from the different lengths of their method lists. This is related to [perl #128931], about .WHICH not distinguishing identically-named classes, but there's a bit more to this. .WHICH applied to the two Num classes in the above duly shows "Num" for both, so fails to distinguish the class objects. But if given instances of two user-defined classes, I think the object IDs that go into the default .WHICH would be unique across all the classes, so the .WHICHes wouldn't clash. The above clash depends on the non-default .WHICH arrangement for the built-in Num class. Many other classes could produce similar clashes; generally, custom .WHICH methods are relying on the class part of a .WHICH string uniquely identifying the class. -zefram