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
Conditional 'return()' in function call #14721
Comments
From trizenx@gmail.comLet's assume the following code: #===BEGIN===# use 5.010; sub a { sub b { b(a() // return(), "bar"); # this fails #===END===# In the first call, the second parameter ($y) becomes undefined. This is triggered by the return keyword used with parentheses. In the second call, after removing the parentheses, it seems to work correctly. Also, wrapping the return inside parentheses seems to work too. As far as I tested, the issue can be reproduced only with the "return" keyword. It's reproducible with the following versions of Perl (and possible others): 5.14.4, 5.20.2, perl-5.22.0-RC2 Output: #===BEGIN===# foo |
From zefram@fysh.orgDaniel Suteu wrote:
Not a bug: return just has exceptional grammatical behaviour, that it $ perl -MO=Deparse -e 'b(a() // return(), "bar");' The other two cases `work' because they do not admit such a parsing. It might be worth us adding a warning about this kind of case, where We could also consider deprecating the current behaviour and turning -zefram |
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#125286 (status was 'open')
Searchable as RT125286$
The text was updated successfully, but these errors were encountered: