[Bioperl-l] Moose and Roles

Mark A. Jensen maj at fortinbras.us
Tue May 26 21:35:20 UTC 2009


----- Original Message ----- 
From: "Chris Mungall" <cjm at berkeleybop.org>
To: "Mark A. Jensen" <maj at fortinbras.us>
Cc: "Chris Fields" <cjfields at illinois.edu>; "BioPerl List" 
<bioperl-l at lists.open-bio.org>
Sent: Tuesday, May 26, 2009 4:26 PM
Subject: Re: [Bioperl-l] Moose and Roles


>
> This seems to be overloading the namespacing mechanism. Presumably  each $X in 
> {Root,Seq,Phylo,...} etc will need their own roles. Would  these go in 
> Bio::Role::$X:: or Bio::$X::Role::?
Right-- Roles could (should?) be applied across objects in higher level domains
(e.g., I can imagine roles that both Hit::GenericHit and HSP::GenericHSP could
take on), so I would push the Bio::Role::[Path] direction.

>
> For the names I prefer either (a) the convention of using adjectives  or 
> adjectival phrases to denote roles or (b) spelling it out rather  than using 
> hungarian notation (e.g. DescribableRole rather than  Describable)
>
+1; would you accept predicates such as "DoesDescriptiveStats"?

> On May 26, 2009, at 12:37 PM, Mark A. Jensen wrote:
>
>> I think I'd want to go completely Moose-y and call them  Bio::Role::.x (The 
>> 'I' is sort of a semantic kludge, as I understand  it)
>> MAJ
>> ----- Original Message ----- From: "Chris Fields" <cjfields at illinois.edu
>> >
>> To: "BioPerl List" <bioperl-l at lists.open-bio.org>
>> Sent: Tuesday, May 26, 2009 2:50 PM
>> Subject: [Bioperl-l] Moose and Roles
>>
>>
>>> All,
>>> (If you aren't interested in Moose, feel free to ignore)
>>> I'm toying a bit with Moose to get some basic BioPerl-like classes 
>>> rolling.  One thing that's popping up early is refactoring  interfaces 
>>> (Bio::IdentifiableI, Bio::DescribableI) into simple  Roles.  Since  roles 
>>> are geared towards particular actions a class  performs (a class  'Foo' does 
>>> role 'Bar'), how do we want to name  these to not confuse  them with regular 
>>> classes?  Interface  convention for BioPerl was  affixing the class name 
>>> with 'I'; we  could affix these with  'R'/'Role'.  Or should we have a 
>>> specific  Bio::Role namespace?
>>> Suggestions welcome!
>>> chris
>>> PS: Here's the basic syntax in Moose-ish (very simple):
>>> # role
>>> package Bio::DescribableR;
>>> use Bio::Root::Role;
>>> has description => (
>>>    is     => 'rw',
>>>    isa    => 'Str'
>>> );
>>> no Bio::Root::Role;
>>> package Foo;
>>> use Bio::Root::Moose;
>>> with 'Bio::DescribableR';
>>> # description gets mixed-in, not inherited
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at lists.open-bio.org
>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
>
> 




More information about the Bioperl-l mailing list