On Sun, Jun 12, 2011 at 04:12:31PM -0700, Father Chrysostomos wrote: > $ perl5.14.0 -e 'continue;' > syntax error at -e line 1, near "continue" > Execution of -e aborted due to compilation errors. > > I thought the whole purpose of feature.pm was to avoid conflicts with > user-defined subroutines. Since 'continue' is a syntax error anyway > without feature.pm, should it be necessary to load feature.pm to get a > bare 'continue' as a keyword (with its when-exiting meaning)? > > Making it the same as any other keyword, and not dependent upon > feature.pm, actually simplifies the code in toke.c I'm not convinced that this is a good thing. It turns a compile time syntax error: $ perl5.8.9 -cle 'use strict; continue;' syntax error at -e line 1, near "; continue"-e had compilation errors. into a run time error: $ ./perl -Ilib -cle 'use strict; continue;'-e syntax OK $ ./perl -Ilib -le 'use strict; continue;' Can't "continue" outside a when block at -e line 1. And it's not really helping anyone use a subroutine named continue, as it turns out one *has* to use & syntax to call it: $ perl5.8.9 -cle 'use strict; sub continue {print "Hi"}; continue;' syntax error at -e line 1, near "; continue" -e had compilation errors. $ perl5.8.9 -cle 'use strict; sub continue {print "Hi"}; continue();' syntax error at -e line 1, near "; continue" -e had compilation errors. $ perl5.8.9 -cle 'use strict; sub continue {print "Hi"}; &continue();' -e syntax OK again, all the compile time errors become run time errors: $ ./perl -Ilib -cle 'use strict; sub continue {print "Hi"}; continue;' -e syntax OK $ ./perl -Ilib -cle 'use strict; sub continue {print "Hi"}; continue();' -e syntax OK $ ./perl -Ilib -cle 'use strict; sub continue {print "Hi"}; &continue();' -e syntax OK $ ./perl -Ilib -le 'use strict; sub continue {print "Hi"}; continue;' Can't "continue" outside a when block at -e line 1. $ ./perl -Ilib -le 'use strict; sub continue {print "Hi"}; continue();' Can't "continue" outside a when block at -e line 1. $ ./perl -Ilib -le 'use strict; sub continue {print "Hi"}; &continue();' Hi I can't actually work out what it now enables, that previously wasn't possible, or wasn't easy. I agree that simplifying toke.c (by 12 lines) is a win. But I don't think it's enough of a win, given that it shunts error detection to runtime, and means that the documentation has got just a bit more complex: Except for C<continue>, these are available only if you enable the C<"switch"> feature or use the C<CORE::> prefix. See L<feature> and L<perlsyn/"Switch Statements">. Alternately, include a C<use v5.10> or later to the current scope. In Perl 5.14 and earlier, C<continue> required the C<"switch"> feature, like the other keywords. A lot of people are each paying a tiny price for a small benefit to a small number of core developers. Nicholas ClarkThread Previous | Thread Next