On 28 June 2013 00:48, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote: > Peter Rabbitson <rabbit-p5p@rabbit.us> writes: > >> On Thu, Jun 27, 2013 at 10:56:13AM +0100, Nicholas Clark wrote: >> >>> The case of (IIRC) do subroutine syntax springs to mind. IIRC chromatic >>> calculated that 2% (or was it 4%) of the Perl grammar exists just to deal >>> with it. > > It's 43 out of 1444 lines in perly.y, so just a hair under 3%. > >> Being 2 (or 4%) of the grammar, and being a special case of invocation >> (thus likely having an effect on entersub or somesuch) > > It doesn't have any runtime effect, it compiles to a bog standard > ENTERSUB op (with the OPf_SPECIAL flag set, which is only used by > B::Deparse to output the "do" correctly). > >> - in any case - there is *tangible* technical benefit of removing >> this. I do not believe it would be reasonable to complain if this were >> removed during a *related* encounter with this part of the >> parser/lexer/whathaveyou. > > It's entirely self-contained in the grammar > (http://perl5.git.perl.org/perl.git/blob/HEAD:/perly.y#l1110 et seq), so > the only reason to touch it would be if you're changing how ENTERSUB ops > are built in general. > > Out of curiosity, I went and ripped it (and related tests) out. The > diffstat, excluding generated files, is: > > perly.c | 3 -- > perly.y | 43 ----------------------------- > pod/perlfunc.pod | 6 ---- > t/lib/warnings/perly | 30 -------------------- > t/op/do.t | 66 ++------------------------------------------ > t/op/lexsub.t | 31 +-------------------- > 6 files changed, 3 insertions(+), 176 deletions(-) > > And a regen_perly.pl run adds: > > perly.act | 304 ++++++------- > perly.h | 2 +- > perly.tab | 1229 +++++++++++++++++++++++++---------------------------- > 3 files changed, 704 insertions(+), 831 deletions(-) > > The results are at https://github.com/ilmari/perl/tree/remove-do-sub if > anyone is interesed. /me votes apply Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next