On Fri, Sep 23, 2016 at 11:42:20PM -0700, Itsuki Toyota wrote: : # New Ticket Created by Itsuki Toyota : # Please include the string: [perl #129346] : # in the subject line of all future correspondence about this issue. : # <URL: https://rt.perl.org/Ticket/Display.html?id=129346 > : : : See the following results : : $ perl6 -e 'sub foo(\a where { *.WHAT === Int } ) { say "Hello"; }; foo(10);' : Constraint type check failed for parameter 'a' : in sub foo at -e line 1 : in block <unit> at -e line 1
Even if .WHAT were not special, this wouldn't ever work, because you've got a double-closure there, one from the curlies, and the other from the *. So the outer closure would return the inner closure, which would always evaluate to true. : $ perl6 -e 'sub foo(\a where -> \e { \e.WHAT === Int } ) { say "Hello"; }; foo(10);' : Constraint type check failed for parameter 'a' : in sub foo at -e line 1 : in block <unit> at -e line 1 This will never work because \e.WHAT returns a Capture object, which will never === Int. : $ perl6 -e 'sub foo(\a where -> \e { e.WHAT === Int } ) { say "Hello"; }; foo(10);' : Hello That is, in fact, a correct way to write it. : It seems that "Whatever *" cannot handle sigilless values correctly. The sigilless variable isn't declared yet, so a.WHAT doesn't work either. But this is another correct way to write it: $ perl6 -e 'sub foo(\a where { .WHAT === Int } ) { say "Hello"; }; foo(10);' Hello Larry