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
permit \escape on right hand side of my #15178
Comments
From @rjbsThis is pretty useful: perl -Mexperimental=refaliasing \ ...but the question I keep hearing is "why is the backslash on the my and not The answer is not weird. It's pre-existing syntax to get a reference to a new my \@y = $x; I even got this question from Larry. We should allow that. It would also be good to allow: my ($x, \@y, \%z) = @_; ...which means we should then allow: sub foo ($x, \@y, \%z) { ... } I would use the *heck* out of that feature. -- |
From @cpansproutOn Fri Feb 12 19:03:22 2016, rjbs wrote:
That surprised me. After all, I was just following his existing Perl 5 syntax.
That begs the question of what $x = my \@y; would do. I imagine it would be the same as $x = \my @y; no?
BTW, is anybody using for \@x (...) yet? -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
From @rjbsOn Sat Feb 13 09:48:36 2016, sprout wrote:
I think that the feature looks so new that it's easy to forget how it's using existing syntax, especially since it's syntax one is fairly unlikely to use.
That's my thinking as well.
I believe I have used "for my \%x" a few times, if this meets your criteria. :) -- |
From @cpansproutOn Sat Feb 13 18:58:46 2016, rjbs wrote:
Would rvalue use of ‘my \’ be governed by the experimental::refaliasing feature feature? Would they produce an experimental warning? -- Father Chrysostomos |
From @ap* Father Chrysostomos via RT <perlbug-followup@perl.org> [2016-05-18 08:23]:
The value of the refaliasing feature does not depend on whether the new I think they should be separate experiments. Would refaliasing automatically adopt the new syntax if it is introduced Regards, |
From @cpansproutOn Fri May 20 19:53:40 2016, aristotle wrote:
They would not be interdependent. In fact, the new syntax would just be a matter of switching the two tokens around in the lexer, which is kinda hard to get wrong, so I wonder whether it even needs to be experimental, except as a matter of principle. Assuming the latter (principle), what would we call it? my_whack? (Though I usually drop the h for that slang term: my_wack.) my_refcons? (BTW, not having it experimental would make the implementation a bit easier.) -- Father Chrysostomos |
From @cpansproutOn Fri May 20 22:03:00 2016, sprout wrote:
See the sprout/mywack branch. It’s a six-line patch. -- Father Chrysostomos |
From @cpansproutOn Fri May 20 22:31:49 2016, sprout wrote:
Oh, but what about my(\$a, $b, \$c)? If that should be permitted, then it is not just a six-line patch, but it will still not interfere with refaliasing. And I still don’t know what to call it if it will be experimental. -- Father Chrysostomos |
From @rjbs* Father Chrysostomos via RT <perlbug-followup@perl.org> [2016-05-21T14:58:38]
I'd think so, imagining something like: my ($self, \@arg) = @_;
I'm not too worried about a name. refs_in_my? -- |
From @cpansproutOn Sun May 22 18:06:43 2016, perl.p5p@rjbs.manxome.org wrote:
You do realise, I hope, that $_[1] is expected to be an array ref, there?
I’m been thinking of declared_refs, since it applies to the two other *declarators* as well. -- Father Chrysostomos |
From @cpansproutIf \local $x = $foo works, then local \$x should, do. But what about delete local \$foo{bar}? Should I duck? -- Father Chrysostomos |
From @demerphqI hate this syntax for exactly this type of ugly edge case. Better to
|
From @cpansproutOn Sun May 22 19:51:58 2016, demerphq wrote:
Are you referring to the use of backslashes?
I was half joking about delete local \$foo{bar}. That can remain a syntax error.
Data::Alias has a smart-match-like list of which types of syntax passed to the function will result in aliasing. I don’t think we should follow that route. With \ notation, the intent is always clear. With Data::Alias, I find that not to be the case. I have tried learning how to use it, but it just confuses me. Also, you end up with the whole issue again of whether alias @x = @y should alias the arrays or the individual elements. The fact that we have a distinction between \@a and \(@a) that people already know about was one of the main reasons for going with that notation. -- Father Chrysostomos |
From @cpansproutThe sprout/mywack contains what I believe is a working implementation, but it needs docs (including perldiag entries) and tests. I hope someone can take over from here, because I don’t know when I will next have time. Things to test for: my \$a # equivalent to \my $a foreach my \$x ($y) { ... } ditto with state/our/local (except that local does not take attributes or work in foreach). Note that assignment to ‘my \$a : foo’ does not currently work, except with ‘our’ (bug #128183). That is not related to the my\ syntax per se. -- Father Chrysostomos |
From @rjbs* Father Chrysostomos via RT <perlbug-followup@perl.org> [2016-05-22T21:27:10]
Yes, of course. It's only through that that you can write: my ($self, \@arg, \%arg) = @_; ...and someday hope to land that into signatures.
That's better. -- |
From @demerphqHate was too strong a word. Thanks for explaining and thanks for doing this
|
From @cpansproutOn Mon May 23 04:41:56 2016, perl.p5p@rjbs.manxome.org wrote:
I have just re-read your original post, which I neglected to do. I see I have made some pretty inane statements in this thread. In any case, my branch does not touch signatures, and I don’t know when I will have time to continue with this. -- Father Chrysostomos |
From @rjbsOn Mon May 23 12:46:35 2016, sprout wrote:
Getting it working outside of signatures is still, I think, a good start. I haven't yet had a chance to compile the branch or play with it. I hope to do so, but I'm not sure when. Hopefully someone else will also be excited to have this working. -- |
From @cpansproutOn Mon May 23 13:09:38 2016, rjbs wrote:
I think we should put signatures in a separate ticket, since the issues really are orthogonal. (That’s not to say they can’t be implemented at the same time.) I have opened ticket #128242. -- Father Chrysostomos |
From @ap* Father Chrysostomos via RT <perlbug-followup@perl.org> [2016-05-23 12:23]:
Did you really mean the following as you wrote it, or as I rewrote it?
my (\$a, $b) # equivalent to (\my $a, my $b) Regards, |
From @cpansproutOn Fri May 27 04:41:20 2016, aristotle wrote:
As you rewrote it. -- Father Chrysostomos |
From @cpansproutOn Mon May 23 13:09:38 2016, rjbs wrote:
I have written some rudimentary documentation and tests for the warnings and error messages, and pushed them to the sprout/mywack branch. That’s probably it for now until next weekend (assuming I get time next weekend). -- Father Chrysostomos |
From @cpansproutI finished writing tests. My branch is now merged as 6fe925b. Signatures are unaffected. (The other ticket, #128242, remains open.) -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.26.0, this and 210 other issues have been Perl 5.26.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#127531 (status was 'resolved')
Searchable as RT127531$
The text was updated successfully, but these errors were encountered: