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


Code:
say 4 ~~ (4,5,6,7)

Result:
False

Most people expect that it will check if the list on the RHS contains 4, but 
that's not what it does. The right way to do it is to use any(4,5,6,7).

Another thing that it could possibly do is to count the number of elements in 
the list, as in 4 == +(4,5,6,7), but again that's not what it does.

Example above clearly shows that both of these assumptions are wrong.

So what does it do?

The relevant piece of code is here: 
https://github.com/rakudo/rakudo/blob/nom/src/core/List.pm#L426 . In other 
words, it always returns False, but it also returns empty list if RHS list is 
empty or a RHS list itself if the first element of it is a Match object.

Does it make any sense? Not at all, at least to a typical user.


The proposal is to make it DWIM. That is, make 4 ~~ (4,5,6,7) work like 4 
(elem) (4,5,6,7).

See also IRC log: http://irclog.perlgeek.de/perl6/2016-04-24#i_12386065

Reply via email to