stevan / p5-mop-redux

A(nother) MOP for Perl 5
139 stars 36 forks source link

method keyword and subroutine signatures is parts of mop? #27

Closed yuki-kimoto closed 11 years ago

yuki-kimoto commented 11 years ago

In mop prototype, multiple features is mixed.

class Point {
    has $x is rw;
    #1. method keyword ( automatically shift $self ) 
    #2. subroutine signatures
    method foo ($bar, $baz) {
        $self->x;
    }
}

Is method keyword part of mop? or independent feature?

Subroutine signature is independent feature, but current mop seem to implement subroutine signatures by itself.

These features will be separated into each parts in the future.

Is it good to prepare features separating?

stevan commented 11 years ago

The method and class keywords are part of the MOP, along with the has keyword.

We implement it all ourselves simply because it is a prototype and need control over all the details during this stage.

It is pretty safe to assume that once the subroutine signatures land in core, the MOP will use that to implement the methods.

Anything inside the mop::internal:: namespace, which is currently the syntax and MRO implementations, would need to be rewritten in the core, so the current implementation should be viewed as only a prototype.

yuki-kimoto commented 11 years ago

I afraid if anonymous method is implemented in perl core, this will crash mop method keyword.

my $method = method { ... }; 

In this case, method keyword can be used outside of clsss { }.

stevan commented 11 years ago

Yes, ideally method a d has will only be valid within a class block.

On Jul 18, 2013, at 8:30 PM, Yuki Kimoto notifications@github.com wrote:

I afraid if anonymous method is implemented in perl core, this will crash mop method keyword.

my $method = method { ... }; In this case, method keyword is used outside of clsss { };

— Reply to this email directly or view it on GitHub.

doy commented 11 years ago

We will be sure to work with p5p to avoid this sorts of conflicts, in any case. I don't think there will be any real problems here.