# New Ticket Created by David Warring # Please include the string: [perl #130222] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=130222 >
One example from this stack overflow question: question http://stackoverflow.com/questions/40814933/how-do-the-perl-6-set-operations-compare-elements my $num_set = set( < 1 2 3 4 > ); say "set: ", $num_set.perl; say "4 is in set: ", 4 ∈ $num_set; # False say "IntStr 4 is in set: ", IntStr.new(4, "Four") ∈ $num_set; $ True As noted is the thread it's unexpected and a likely trap that's difficult to explain to beginners. The current implementation is supposed to make it easy to form sets of general objects. But in practice even that's fragile. Consider: my $v = 42; my $s = set($v); $v does role {}; say $v ∈ $s; # False Applying a role to the object has had the side effect. Its no longer recognized as being an element in the set. I suspect the general idea of using .WHICH as a discriminator between elements isn't working well in practice. Maybe we should pull this back and use something simpler and more inclusive such as .Str?
