Redirecting thread to language because I do agree that this is no longer a matter of a bug.
On Fri, Sep 18, 2009 at 9:28 AM, Moritz Lenz via RT < perl6-bugs-follo...@perl.org> wrote: > On Thu Sep 17 08:53:59 2009, ajs wrote: > > This code behaves as expected, matching 2 or 3 in only one out of the > three > > cases: > > You say yourself that it behaves as expected, I don't see any bug. > > Yeah, I dropped a comma. That should have been "This code behaves as expected, matching 2 or 3, in only one out of the three cases. > The case 2..3 (Range) is pretty clear. S03/Smart Matching/ says about > Arrays: > > Any Array lists are comparable @$_ «===» X > > so it tries to interpret the LHS as a List and checks for element-wise > identity => False > I think I see where you're going, here: that ranges are explicitly called out in the spec for given (I haven't double-checked that, but I seem to recall that that's right). The problem is that we now have this rule (which is what caught me, here and made me think this was a bug): 2,3 constructs a list. 2..3 also constructs a list, unless it's in a given/when condition in which case it's just a range. That seems confusing. Is there any value at all in comparing a scalar to a list for identity by default? Why wouldn't we apply any() implicitly and get free consistency with the behavior of lists constructed with ..? Original code: my $a = 2; print "Test 1 (anon array): "; given $a { when [2,3] { say "Good" } default { say "Bad" } } print "Test 2 (..): "; given $a { when 2..3 { say "Good" } default { say "Bad" } } print "Test 3 (bare ,): "; given $a { when 2,3 { say "Good" } default { say "Bad" } }