[Bioperl-l] named parameters
Ewan Birney
birney@ebi.ac.uk
Wed, 3 Jan 2001 17:39:19 +0000 (GMT)
On Wed, 3 Jan 2001, Jason Stajich wrote:
> This is a bit on inconsistency when we specify parameters to new in some
> of the bioperl modules. Whenever we don't use named parameters (ie
> -file=> 'filename'), we are inconsistent with the fact that all modules
> inherit from Bio::Root::RootI. This is because Bio::Root::RootI will
> parse a couple of special parameters - specifically
> -verbose, -strict, -name, -obj, -record_err
>
> now we really don't use these that much, however, in the case of
> Bio::Species
>
> one would call
> my @classification = qw( sapiens Homo Hominidae
> Catarrhini Primates Eutheria
> Mammalia Vertebrata Chordata
> Metazoa Eukaryota )
>
> my $sp = new Bio::Species(@classification);
>
> but if one also wanted debugging turned on, one might call this
> my $sp = new Bio::Species(-verbose=>1, @classification);
>
> This won't bother RootI, but Bio::Species expects all the parameters to be
> part of the classification array.
>
> A solution is to change Bio::Species to expect named parameters so an
> array ref is
>
> $sp = new Bio::Species(-verbose=>1, -classification => \@classification );
>
> What are people's reactions to this? If we can agree that this is
> expected then we can add this to our programming conventions wiki page.
I think we should stick to named parameters throughout and have it as a
programming convention...
>
> -Jason
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>
-----------------------------------------------------------------
Ewan Birney. Mobile: +44 (0)7970 151230, Work: +44 1223 494420
<birney@ebi.ac.uk>.
-----------------------------------------------------------------