-
Notifications
You must be signed in to change notification settings - Fork 556
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
%foo->@{...} works #17722
Comments
Note that perlop doesn't explicitly mention |
That sentence is more referring to the postderef feature in the abstract, rather than the specific feature.pm argument. Perhaps it could be reworded to "postfix dereference syntax" like the referenced perlref section. |
backref: https://stackoverflow.com/questions/61237808/is-postderef-syntax-on-hashes-supported backbackref: conversation on irc.freenode.org#perl 2020-04-15T2:02:00 UTC-0700 |
Or conversely, re-allow |
Allowing |
You are gravely mistaken about what people expect :) Personally, I prefer limiting it to references, but it would not be contrary to expectations for it to work on |
The expectations of people that misunderstand Perl's syntax are not a good target for syntax extensions. |
We're talking about what the syntax should be, so people's expectations are relevant. Furthermore, we're talking about syntax that's been valid for 20 years, so it's kinda disingenuous to say they are mistaken in their understanding. Finally, I didn't say people might expect |
While indeed efforts are made toward bugwards compatibility, it is still just that, and I know of no significant usage of this syntax that would warrant more than the deprecation and removal it had. Regarding its worth, it is certainly not worth providing a new syntax inconsistent with the rest of Perl that would create expectations of other random syntaxes by extension. |
| a new syntax inconsistent with the rest of Perl Except it's not. There's a 20 year history of non-references being accepted on the LHS of ->. Then there's |
I don't much care about this, but I found it intuitive as-is. I'm ok with the modification in behavior. To clarify the confusion: from my read of
As a stylistically better (though longer) alternative to
But to have a discontinuity between a slice from a ref, and a slice from a hash like,
Perhaps I was wrong, but it seems like the advantage of |
This is a bug report generated with the help of perlbug 1.41 running under perl 5.30.2.
The left side of
->
is supposed to be an expression that returns a reference.But
%foo->@{...}
works.Note that
%foo->{a}
used to work, but it was deemed to be a bug. It was deprecated in 5.12, and fixed in 5.22. The same should be done to%foo->@{...}
. I haven't tested any of the other postfix dereference syntaxes to see if they have the same problem.- ikegami
The text was updated successfully, but these errors were encountered: