[Bioperl-l] Perl 6 has 'roles' - may be cleanly applicable to the Root/RootI issue

Stephen Gordon Lenk slenk at emich.edu
Tue Oct 3 17:31:47 UTC 2006


I looked at the Perl6 site, there is an RFC on interfaces:
http://dev.perl.org/perl6/rfc/265.html

Roles seem to be the Perl 6 answer to the Root/RootI issue in Bioperl. 
Maybe it is too early to suggest this.

http://dev.perl.org/perl6/doc/design/apo/A12.html:
The primary role of a class is to manage instances, that is, objects. 
So a class must worry about object creation and destruction, and 
everything that happens in between. Classes have a secondary role as 
units of software reuse, in that they can be inherited from or 
delegated to. However, because this is a secondary role, and because 
of weaknesses in models of inheritance, composition, and delegation, 
Perl 6 will split out the notion of software reuse into a separate 
class-like entity called a "role". Roles are an abstraction mechanism 
for use by classes that don't care about the secondary aspects of 
software reuse, or that (looking at it the other way) care so much 
about it that they want to encapsulate any decisions about 
implementation, composition, delegation, and maybe even inheritance. 
Sounds fancy, but just think of them as includes of partial classes, 
with some safety checks. Roles don't manage objects. They manage 
interfaces and other abstract behavior (like default implementations), 
and they help classes manage objects. As such, a role may only be 
composed into a class or into another role, never inherited from or 
delegated to. That's what classes are for.






More information about the Bioperl-l mailing list