Bioperl: Parameter tag style

Steve A. Chervitz
Thu, 8 Jan 1998 15:40:39 -0800 (PST)

A correction:

> I didn't modify _rearrange() at all. The statements below are equivalent:
>  $aln = new Bio::Tools::UnivAln(SEQS =>\@seqs);
>  $aln = new Bio::Tools::UnivAln(-seqs =>\@seqs);

This is not true. I did in fact change one line:

return @param unless (defined($param[0]) && $param[0]=~/^-/); 

return @param unless (defined($param[0]) && $param[0]=~/^-|^[A-Z]$/); 

So the two statements above are equivalent with my version only.

A potential problem with my version occurs when _rearrange() is 
called with a set of arguments which are not to be treated as named 
parameters, yet the first arg is all cap:
_rearrange('FOOVAL', 'barval') vs. _rearrange( FOO => 'fooval').
But in practice this has not been a problem (famous last words:).

Perhaps it would be best to require all named parameters to begin with 
a hyphen, all caps or not.


Side Note (and new issue!):

All of my modules inherit rearrange() from my

Note also that originally I removed the underscore from _rearrange() 
since I considered this a protected method, not private. Traditionally in 
perl, leading underscores are reserved for private methods. I haven't 
discovered a perl convention for methods that are to be considered 
protected. It may be best to also name these with leading underscores 
since protected methods are not part of a class's public interface.

Consistent naming of private and protected methods would also facilitate 
the operation of a module by itself or within an inheritance hierarchy, 
as I am using PreSeq and UnivAln. Therefore, in the future I plan to use 
leading underscores for protected as well as private methods (unless I 
learn of a better perl convention or mechanism).

=========== Bioperl Project Mailing List Message Footer =======
Project URL:
For info about how to (un)subscribe, where messages are archived, etc: