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
Error: methods declared outside of class {...} #4976
Comments
From @zoffixznetIf you have a file that declares class Foo { ... } and then you define a method OUTSIDE of those curlies and then proceed to call it from another method declared inside of those curclies, you receive a confusing message that talks about attribute access and no hints that you're calling a method that's outside the class's definition. Attached is a sample class that can be called with `perl6 -I. -MFoo -e 'Foo.new.bar'` to reproduce the error. Which on my machine looks like this: zoffix@ZofMain:/tmp/tmp.DPywLvk6la$ cat > Foo.pm6 method mers { |
From @zoffixznet |
From @ninerWell, declaring methods outside of class scopes is a feature:
Of course, as the method is outside the class scope, it cannot access private attributes. |
The RT System itself - Status changed from 'new' to 'open' |
From @zoffixznet
Didn't realize it was a feature. My only suggestion would be to change "in this context" to "methods declared outside of class declaration" (or something like that). Not sure how doable that is. |
Migrated from rt.perl.org#127117 (status was 'open')
Searchable as RT127117$
The text was updated successfully, but these errors were encountered: