stevan / p5-mop-redux

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

Support for the PACKAGE VERSION syntax #57

Closed tobyink closed 11 years ago

tobyink commented 11 years ago

Since 5.14, Perl has supported this syntax for declaring a version number for a package:

package Foo 1.0 {
    ....;
}

This pull request adds similar version declaration to the class and role keywords:

role Foo 1.0 {
    ...;
}
class Bar 1.0 with Foo {
    ...;
}
tobyink commented 11 years ago

A possible extension to this would be to support:

class Bar 1.0 extends Foo 1.1 {
}

... which would die if the available version of Foo is less than 1.1.

doy commented 11 years ago

I do think that the

class Bar extends Foo 1.1 { }

syntax is also a good idea (should be for all of extends, with, and metaclass).