[Bioperl-l] multiple inheritance
Jason Stajich
jason at cgt.duhs.duke.edu
Wed Jul 30 16:12:46 EDT 2003
Hmm - how should we solve the multiple inheritance when we want to chain
both constructors. Using SUPER just goes up the tree and will follow B
first up to A and never call C's constructor.
package D;
@ISA = qw(B C);
A
/ \
B C
\ /
D
The Right Way* to do this is of course not having multiple inheritance OR
to use The Damian's NEXT
http://search.cpan.org/author/DCONWAY/NEXT-0.50/lib/NEXT.pm
We run into this for SeqFeature::SimilarityPair which ISA FeaturePair and
a Similarity - the soln there was not to rely on the constructor for
initializing parameters.
I am hitting it again for my Tree::AlleleNode objects which are
PopGen::Individuals (genotype containers) and Tree::Node (as part of the
coalescent).
My soln will be to explictly code all the initialization parameters for
the skipped superclass (C as in above example) as copy+paste
NEXT is part of perl 5.8.0 and would remove a lot of issues wrt to
chaining destructors that we have some code hacks for in Bio::Root::Root.
But I am wary of adding another module dependancy.
Comments?
--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu
More information about the Bioperl-l
mailing list