develooper Front page | perl.perl5.porters | Postings from January 2011

Re: [PATCH] use feature 'method'; (was Re: Proposal: "$->" forimplicit invocant)

Thread Previous | Thread Next
From:
Eric Brine
Date:
January 20, 2011 15:43
Subject:
Re: [PATCH] use feature 'method'; (was Re: Proposal: "$->" forimplicit invocant)
Message ID:
AANLkTinPhwzHFPx4CPCS0jJ6EAiB8=kQENuoX_BLEV9J@mail.gmail.com
On Thu, Jan 20, 2011 at 2:28 PM, chromatic <chromatic@wgz.org> wrote:

> On Thursday 20 January 2011 at 10:32, Zefram  wrote:
>
 > It also seems very unwise for the core to take the keyword "method" at
> > this stage.  We have several CPAN modules supplying "method" keywords
> > with various semantics, it's an unresolved area.
>
> To my knowledge, none of them import 'method' from feature.pm.
>

If you can write the following to define a class, no problem.

use 5.016;
use Something::Which::Provides::Method;

If you have to write the following to define a class using another module,
maybe "method" is not the best choice of keyword.

use 5.016;
no feature 'method';
use Something::Which::Provides::Method;


>  > As something to go in the core, I do not approve of this shortcut.
> > You should definitely build the optree rather than stuff source.
>
> That means:
>
>  * grabbing the optree *already generated* for the body of the sub
>
 * ...
>

Why can't the parser handle it when generating the optree in the first
place? The parser knows that the block will be a method body before the
block is parsed.

- Eric

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