-
Notifications
You must be signed in to change notification settings - Fork 597
return doesn't allow an indirect object #21729
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
Conversation
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.
As this change makes a few things become compiletime errors that previously had been either runtime errors or potentially fine if subs were defined late, it's probably worth at least a mention in the perldelta so if people find code breaks they know why.
Since return isn't actually a function, I didn't think the "function" part of the original message applied. Fixes Perl#21716
83308cc
to
12ea353
Compare
If the sub is defined late the indirect object has already been compiled into an
It even runs and returns a GV:
So perhaps it should be a deprecation instead. That would make me sad for such obviously broken code, since it seems more likely that the intent is to call a function rather than return a glob. |
which my perldelta illustrates. |
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.
LGTM
I think this looks fine, though we should keep an eye out for BBC reports in case it turns out there's modules around that break on it - or even that actually rely on it to work.
I also considered a parser approach to fixing this (splitting LSTOP into list ops that take an indirob and those that don't), but that's more complex and riskier. |
Since return isn't actually a function, I didn't think the "function" part of the original message applied.
Fixes #21716