A Questionaire / Re: Bioperl: Parameter tag styl

Georg Fuellen fuellen@dali.Mathematik.Uni-Bielefeld.DE
Mon, 12 Jan 1998 23:04:23 +0000 (GMT)

[ If you have 5 minutes, please take a look at the following
questionaire on bioinformatics education:
Thanks a lot ! I'd be very grateful. ]

SteveC wrote,
> The first thing _rearrange() does is to strip off the hyphens from the 
> parameter tags and capitalize them, (so, in principle, I'm saving 
> _rearrange() the extra work!). But this brings up a good issue that I would 
> like your comments on. I decided to use ALL CAPS for named parameters for 
> these reasons:
>   1) A naming conflict can occur if a module has a method with the same 
> name as a parameter. For example, if I call $fooObj->get(-file=>'readme')
> and module Foo.pm defines a sub file {...}, perl may generate a 
> warning that it interpreted the -file parameter name as -&file. I say 
> "may" because sometimes perl seems to do the right thing and interpret 
> -file as '-file'. But I have seen cases where this fails. I haven't 
> been able to pin-point why, though (any ideas?). 

Possibly -file is interpreted differently depending on whether
``file()'' is a function that returns a scalar, in contrast to a 
function that returns an array value ?!

SteveC wrote [in a followup mail]:
> 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.

My feeling is that we should find out whether the odd behaviour 
(Perl interpreting -file=>'filename' as a function call to file())
is still present in 5.004 / the latest developers' release. If so,
we should find out whether it's considered a bug that will be fixed
in the next release. 

> SteveC
> Side Note (and new issue!):
> All of my modules inherit rearrange() from my Obj::Object.pm
> http://genome-www.stanford.edu/perlOOP/bioperl/lib/Obj/Object.pm
> 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).

I agree on this, I hope I'm doing the same thing consistently.

best wishes,

=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/
For info about how to (un)subscribe, where messages are archived, etc: