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
attributes affect listiness of declarations #16220
Comments
From zefram@fysh.orgCreated by zefram@fysh.orgA "my" declaration of a scalar variable, with no parens, is a scalar $ perl -lwe '@p = qw(x y z); my $a = @p; print $a' If it's enclosed in parens, that makes a list for the purposes of $ perl -lwe '@p = qw(x y z); (my $a) = @p; print $a' But if the declaration also includes an attribute, then the parenthesised $ perl -lwe '@p = qw(x y z); (my $a :shared) = @p; print $a' That looks like a bug to me. Note that it's possible to have a scalar $ perl -lwe '@p = qw(x y z); my $a :shared = @p; print $a' Also, the scalarness isn't strictly driven by the use of attribute syntax, $ perl -lwe '@p = qw(x y z); (my $a :) = @p; print $a' This bug has some effect on [perl #114932], in that "(state $a :shared) $ perl -Mfeature=state -lwe '@p = qw(x y z); sub f { (state $a :shared) = @p; print $a; } f(); unshift @p, "w"; f()' Although I found this while investigating [perl #114932], and it has some Perl Info
|
Migrated from rt.perl.org#132393 (status was 'new')
Searchable as RT132393$
The text was updated successfully, but these errors were encountered: