develooper Front page | perl.perl5.porters | Postings from April 2012

Re: [perl #108286] Wishlist: Overridable keywords

Thread Previous | Thread Next
From:
Eric Brine
Date:
April 22, 2012 13:25
Subject:
Re: [perl #108286] Wishlist: Overridable keywords
Message ID:
CALJW-qGG7AoU9hvEmtr38jqqGxta+kJG5deTw5rhA-nG8jbSPA@mail.gmail.com
On Sun, Apr 22, 2012 at 1:41 AM, Father Chrysostomos via RT <
perlbug-comment@perl.org> wrote:

> On Wed Apr 04 13:53:55 2012, ikegami@adaelis.com wrote:
> > The builtin "if" should expect the following to follow it (ignoring
> > whitespace)
> >
> > "(" EXPR ")" BLOCK ( "elsif" "(" EXPR ")" BLOCK )* ( "else" BLOCK )?
> >
> > None of those tokens should be overridable when parsing that rule
> (although
> > EXPR and BLOCK may use overridden tokens).
>
> In that case, is there any reason why elsif needs to be a reserved word
> outside of that context?
>

I was wondering that myself when I typed the above. We allow C<< sub if { }
>>, so why not C<< sub elsif { } >>?

I'm not seeing the value of C<< elsif(); >> being a syntax error. The two
reasons I can come up for continuing to be a syntax error are confusion
avoidance and syntax error detection, but neither reason is valid. We
already allow C<< sub if { } >>, and C<< elsif (...) { ... } >> would still
be a syntax error if C<< elsif(...); >> isn't.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About