NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Then what is a Role? (Score:1)
because they can be either an interface
role Shootable {
requires qw(ready aim fire);
}
or a Mixin
role Shooting { ... } ... }
requires qw(ready);
method aim (Object target) {
method fire () {
}
or something else entirely …
role Gun with Shooting {
has gun => (
is => 'Gun',
Re: (Score:2)
I thought a Role was a Mixin. :) But I'd say in this case, it depends on how you use it. Kind of like how an abstract class which implements no methods at all is still an interface, even though it might not be called one.
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re:Then what is a Role? (Score:1)
Nah, Mixin inheritance isn't as safe as Role composition. Mixin's can cause diamond patterns in your inheritance, Roles can't (amongst other things).
Reply to This
Parent
Re: (Score:2)
I clearly still have a lot to learn, then. :)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers