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
Change 649d02de (unary prototypes) changes precedence #10546
Comments
From @cpansproutSee http://www.nntp.perl.org/group/perl.perl5.porters/2010/08/msg162945.html The problem is that sub foo(;$) is now parsed as a unary function. So code like this will break: sub foo(;$) { ... } because it now parses as foo($a)<$b rather than foo($a<$b). I thought I had considered all the possibilities of breakage, but this one eluded me. Should we make this a �feature� feature? use feature 'sane_prototype_parsing'; # too long I would be sad to see 649d02d reverted, as the bug it fixes defeats the purpose of change 1db4d19 (making tie overridable) and the original purpose of prototypes (to make subs parse like built-ins). Flags: Site configuration information for perl 5.13.3: Configured by sprout at Thu Aug 12 17:53:37 PDT 2010. Summary of my perl5 (revision 5 version 13 subversion 3 patch v5.13.3-193-g798ae1b) configuration: Locally applied patches: @INC for perl 5.13.3: Environment for perl 5.13.3: |
From @cpansproutOn Aug 15, 2010, at 1:17 PM, Father Chrysostomos wrote:
In case this makes any difference to the decision, the existing behaviour is not just undocumented; it actually contradicts the documented behaviour: ...
|
From zefram@fysh.orgFather Chrysostomos wrote:
Please don't. A much better approach would be to add a facility to the -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @nwc10On Sun, Aug 15, 2010 at 01:17:37PM -0700, Father Chrysostomos wrote:
1: But the changed behaviour is the correct behaviour, by the letter of the
2: Is it only the specific prototype ';$' where this change will cause Nicholas Clark |
From @cpansproutOn Sun, 15 Aug 2010 21:35:08 +0100, Nicholas Clark wrote:
Yes. Ironically (;$), the prototype that Switch is using, is precisely the one that perlsub uses to explain the effect that prototypes have on precedence.
(*) (;$) (;*) are the only prototypes affected. (The (\...) and (;\...) prototypes were syntax errors in all the cases that break for those three.) It only happens when one of these is used in an unparenthesised argument: nonassoc < > <= >= lt gt le ge I think the best solution in this case is to patch Switch.pm and document this under perldelta as a possible cause for breakage. After all, the documentation is quite explicit. I�ve submitted a patch for Switch: http://rt.cpan.org/Ticket/Display.html?id=60380 |
From @iabynOn Sun, Aug 15, 2010 at 05:45:46PM -0700, Father Chrysostomos wrote:
Was a perldelta entry added? If not, could write one? -- |
From @cpansproutOn Aug 25, 2010, at 6:42 AM, Dave Mitchell wrote:
Only the fact that it broke Switch.
Here is that describes it in greater detail, so users will know what to look out for. |
From @cpansproutFrom: Father Chrysostomos <sprout@cpan.org> [perl #77234] Change 649d02d (unary prototypes) changes precedence This patch retroactively adds a description of the breakage to Inline Patch--- blead/pod/perl5134delta.pod.orig 2010-08-26 20:46:07.000000000 -0700
+++ blead/pod/perl5134delta.pod 2010-08-26 21:22:15.000000000 -0700
@@ -102,6 +102,29 @@ exception if they don't match.
Some bit fields have been reordered; therefore, this release will not be binary
compatible with any previous Perl release.
+=head2 Change in the parsing of certain prototypes
+
+Due to a bug fix, functions using the C<(*)>, C<(;$)> and C<(;*)>
+prototypes are parsed with higher precedence than before. So in the
+following example:
+
+ sub foo($);
+ foo $a < $b;
+
+the second line is now parsed correctly as C<< foo($a) < $b >>, rather than
+C<< foo($a < $b) >>. This happens when one of these operators is used in
+an unparenthesised argument:
+
+ < > <= >= lt gt le ge
+ == != <=> eq ne cmp ~~
+ &
+ | ^
+ &&
+ || //
+ .. ...
+ ?:
+ = += -= *= etc.
+
=head1 Deprecations
=head2 List assignment to C<$[> |
From @raflFather Chrysostomos <sprout@cpan.org> writes:
There also was an entry about the changed parsing in perl5134delta, but
What should we do with this? 5.13.4, which contains the change, is |
From @cpansproutOn Aug 29, 2010, at 3:19 PM, Florian Ragwitz wrote:
That was the idea, except the original entry should stay, as it is the only place that mentions all the prototypes that were fixed. But maybe it could be moved to �Selected Bug Fixes�, since it�s not a new feature. |
From @raflFather Chrysostomos <sprout@cpan.org> writes:
Good point. I've applied your patch and moved those two entries |
@rafl - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#77234 (status was 'resolved')
Searchable as RT77234$
The text was updated successfully, but these errors were encountered: