develooper Front page | perl.perl5.porters | Postings from March 2013

Re: Lexical subs allow overriding if/else & other syntax keywords?

Thread Previous
From:
Eric Brine
Date:
March 27, 2013 09:38
Subject:
Re: Lexical subs allow overriding if/else & other syntax keywords?
Message ID:
CALJW-qH4_94i3FUPskyhg+4Riy-jkZd0kMUyAKaWZ8MJJgu36w@mail.gmail.com
On Tue, Mar 26, 2013 at 7:06 PM, Reini Urban <rurban@x-ray.at> wrote:

> On Sun, Mar 24, 2013 at 11:47 PM, Father Chrysostomos <sprout@cpan.org>
> wrote:
> > Zefram wants to deprecate the keyword plugin, in favour of using sub
> lookup for all overrides.  I can see why, as it’s a bit heavy-handed.
>
> Elegant yes, I also implemented if/else/elsif and most other keywords as
> compiler or RT (runtime library) methods in p2.
> But for p5 this does not help us in reaching macros as subs are the
> complete
> opposite of macros. If there is a compiler mechanism not to evaluate the
> sub args, then okay.
>

There is. A call checker attached to the sub can replace the sub call with
any opcode tree it likes. See Syntax::Feature::Loop for an example of this.
It uses lexical subs provided by Lexical::Sub, but that difference is not
significant.

http://cpansearch.perl.org/src/IKEGAMI/Syntax-Feature-Loop-v1.6.0/lib/Syntax/Feature/Loop.xs

Thread Previous


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