[Bioperl-l] Bio::FeatureHolderI interface confusion

Paul Edlefsen pedlefsen at systemsbiology.org
Thu Jun 19 12:30:09 EDT 2003


I don't know for sure, but I'm pretty sure that of the following two 
options, the former is faster.  It's also, to me, prettier:

A)
if( !$feature->isa( 'Bio::MutableFeatureHolderI' ) ) {
  warn "Unable to add subfeature $subfeature: the parent feature 
$feature does not allow the addition of subfeatures.";
} else {
  $feature->add_SeqFeature( $subfeature );
}

B)
eval {
  $feature->add_SeqFeature( $subfeature );
}
if( $@ ) {
  warn "Unable to add subfeature $subfeature: the parent feature 
$feature does not allow the addition of subfeatures.";
}

(Isn't eval() relatively inefficient?  I'd like to know, actually, just 
for general knowing-of-important-things).

:Paul

Hilmar Lapp wrote:

>
> On Thursday, June 19, 2003, at 01:06  AM, Ewan Birney wrote:
>
>>>
>>> Ok, here's a constructive suggestion
>>>
>>> (1) add mutability operations to the SeqFeatureI interface, as Hilmar
>>> suggests.
>>
>>
>> I *really* dislike mutability to interfaces. Certain implementations 
>> just
>> can't do it. Mutability is an implementation specific case. Or we 
>> need to
>> split into immutable and mutable interfaces.
>>
>>
>
> I agree with certain implementations not being able to support 
> mutability. Splitting into mutable and immutable interfaces does 
> contribute to the explosion of interfaces though, and quite honestly 
> in 90% of use cases you need mutability anyway, and literally all 
> modules in bioperl are mutable.
>
> What about allowing implementors to throw an exception on set if they 
> don't support mutability?
>
>     -hilmar
>

-- 
+-----O------------------------------------+
|    o-o     Paul T. Edlefsen
|    o---o   Computational Biologist
|  o----o    mailto:paul at systemsbiology.org
| O----O     Institute for Systems Biology
| 0--o       1441 North 34th Street
|   O        Seattle, Washington 98103-8904
|  o-o       callto:1-206-732-1336
+-o---o------------------------------------+







More information about the Bioperl-l mailing list