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
Warning on @_ outside subroutine #13953
Comments
From @epaCreated by @epaThere should be a warning if @_ is used outside a subroutine. Perl Info
|
From @HugmeirOn Mon, Jun 23, 2014 at 5:31 PM, Ed Avis <perlbug-followup@perl.org> wrote:
-1 Nothing wrong with using @_ outside of a subroutine. And beyond being sub foo {@_} This looks like the sort of warning/coding advice that would be better |
The RT System itself - Status changed from 'new' to 'open' |
From @epaBrian Fraser <fraserbn <at> gmail.com> writes:
This is a highly wizardly shortcut and only in very marginal cases is it This is an efficiency mechanism that new users may wish to avoid. That is outweighed for me by the number of types I have typed @_ instead of -- |
From @kentfredricOn 24 June 2014 18:37, Ed Avis <eda@waniasset.com> wrote:
Another example (ab)use of it: --[ t.pl ]-- sub foo(@) { say foo "Hello", "World"; my $sum = 0; return $sum; I'm not sure if this will count as "Outside a sub" or not. -- |
From @epaThanks for the example. In this case the code included by 'do' is within the subroutine when evaluated at run time. -- ______________________________________________________________________ |
From @ap* Ed Avis <eda@waniasset.com> [2014-06-24 08:40]:
I want to say I’ve never done that once. I cannot know for sure but |
From @ikegamiOn Tue, Jun 24, 2014 at 2:37 AM, Ed Avis <eda@waniasset.com> wrote:
Users of this feature can disable the warning if necessary. |
From @ikegamiOn Mon, Jun 23, 2014 at 11:31 AM, Ed Avis <perlbug-followup@perl.org> wrote:
The benefit is extremely limited. I'm not sure it's worth the space in the Note that it would have to be a run-time warning too if you wanted to catch |
From @rjbsNo, this warning is not worth it. This is easy to detect with a linter in simple cases, anyway. -- |
@rjbs - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#122162 (status was 'rejected')
Searchable as RT122162$
The text was updated successfully, but these errors were encountered: