-
Notifications
You must be signed in to change notification settings - Fork 561
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
Support my method
syntax
#22940
base: blead
Are you sure you want to change the base?
Support my method
syntax
#22940
Conversation
pod/perlclass.pod
Outdated
@@ -185,6 +185,26 @@ Just like regular subroutines, methods I<can> be anonymous: | |||
} | |||
} | |||
|
|||
Methods can also be declared as lexical subroutines, using the C<my> prefix. | |||
This creates a subroutine that is lexically visible within the current scope, | |||
but does not appear in the symbol table. This creates the effect of a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: You have two sentences in a row which start with "This creates...." I suggest rephrasing one of them.
P.S. This is a great addition. Thanks, @leonerd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahyes; given it a slight edit.
I guess it's a nitpicking, but nonetheless. Should it be |
|
This came to light in discussions of Perl/PPCs#68 that
my method
doesn't actually parse as it should. This PR adds that.Admittedly this syntax isn't all that useful without the corresponding
->&
, so I'm happy to defer merging this until we can implement both at once. That way we'd avoid recommending to people the "just call it like a regular sub" workaround; as longterm we might not like that idea anyway.