New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Whatever being called on where-blocked subroutine cannot handle the sigilless values correctly #5675
Comments
From @titsukiSee the following results $ perl6 -e 'sub foo(\a where { *.WHAT === Int } ) { say "Hello"; }; foo(10);' $ perl6 -e 'sub foo(\a where -> \e { \e.WHAT === Int } ) { say "Hello"; }; foo(10);' $ perl6 -e 'sub foo(\a where -> \e { e.WHAT === Int } ) { say "Hello"; }; foo(10);' It seems that "Whatever *" cannot handle sigilless values correctly. $ perl6 --version |
From @LLFournI think this is because .WHAT is a special case. It's not really a method There is an odd what of working around this: perl6 -e 'sub foo(\a where *.&WHAT === Int ) { say "Hello"; }; foo(10); # using the &WHAT sub with postfix syntax you get around the special casing. I'm not sure if .WHAT special casing is considered a bug. I haven't been On Sat, Sep 24, 2016 at 4:42 PM Itsuki Toyota <perl6-bugs-followup@perl.org>
|
The RT System itself - Status changed from 'new' to 'open' |
From @pmichaudOn Sat, Sep 24, 2016 at 07:37:52AM +0000, Lloyd Fournier wrote:
You're correct that .WHAT is a special case. From S12, "Introspection": These should all be considered built-in language primitives, I suppose it's possible that *.WHAT should generate a WhateverCode object... In general, use of these uppercased accessors in ordinary code $obj.WHAT === Dog you usually just want: $obj ~~ Dog So I'd say this isn't actually a bug. Pm |
From @TimToadyOn Fri, Sep 23, 2016 at 11:42:20PM -0700, Itsuki Toyota wrote: Even if .WHAT were not special, this wouldn't ever work, because you've got : $ perl6 -e 'sub foo(\a where -> \e { \e.WHAT === Int } ) { say "Hello"; }; foo(10);' 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);' 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 $ perl6 -e 'sub foo(\a where { .WHAT === Int } ) { say "Hello"; }; foo(10);' Larry |
Migrated from rt.perl.org#129346 (status was 'open')
Searchable as RT129346$
The text was updated successfully, but these errors were encountered: