Caleb Cushing's Blog

Perl Core Syntax Wishlist: Role Support

I want to see Role’s added, even PHP got Traits before Perl. It doesn’t have to be a huge thing, in fact all I want is the composition aspect. Let me do this:

package MyRole {
    sub foo { return 'test' }
package MyClass {
    with 'MyRole';


I don’t really want or need anything else right now, just that would be fine. We should have interfaces too, but they aren’t really required just to support Role’s. We should probably have some sugar like I did for class (e.g. role keyword. and some of the same modules/pragmas loaded for this too).


comments powered by Disqus