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

[perl #108286] Wishlist: Overridable keywords

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
April 21, 2012 22:41
Subject:
[perl #108286] Wishlist: Overridable keywords
Message ID:
rt-3.6.HEAD-4610-1335073311-1349.108286-14-0@perl.org
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’m also trying to plan ahead with regard to adding all keywords to the
CORE:: namespace.

It should be possible in the future for the ‘if’ keyword to be
implemented as a CV named &CORE::if, which has its own custom parser
that eats the elsif and else keywords.

But it won’t make much sense for there to be a &CORE::elsif subroutine.
 It would just be a stub that produces a syntax error when inlined. 
Maybe that does make sense.  Then we could always change it later.

-- 

Father Chrysostomos


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