[Bioperl-l] Feature/Annotation rollback finished

Scott Cain cain.cshl at gmail.com
Wed Aug 29 23:59:11 EDT 2007


Hi Florent,

Of course what you wrote below is true, but what Hilmar was writing
about was lazy programmers (like me) who assume that the empty string
and 0 value cases aren't going to happen (because we happen to know they
never should in certain contexts), and so use 'if ($ann)'.  Of course,
at the moment, I am in the process of de-lazifying my code (though I
tended to think of it as being efficent :-)

Scott


On Wed, 2007-08-29 at 20:44 -0700, Florent Angly wrote:
> Hilmar Lapp wrote:
> > Keep in mind that code such as
> >
> > 	if ($ann) { ... }
> >
> > is mostly not b/c someone wanted to use overloading, but rather  
> > someone was lazy and really meant to say
> >
> > 	if (defined($ann)) { ... }
> >
> > In the absence of eq overloading, these will behave identically. So  
> > if you leave the exceptions in it is sort-of policing lazy  
> > programmers, which I guess is fine in principle, but is guaranteed to  
> > trip up a lot of script code. I'd take it out if you're reasonably  
> > sure that at least within BioPerl itself those lazy programming  
> > incidents are removed.
> 	if ($ann) { ... }
> 
> and 
> 
> 	if (defined($ann)) { ... }
> 
> are not the same.
> 
> 	if ($ann)
> 
> is evaluated false for an empty string like
> 
>         $ann = '';
> 
> and for a value of zero, i.e.
> 
> 	$ann = 0;
> 
> while
> 
> 	defined($ann)
> 
> returns true in these 2 cases.
> 
> Florent
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
-- 
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain at cshl.edu
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.open-bio.org/pipermail/bioperl-l/attachments/20070829/27872681/attachment.bin 


More information about the Bioperl-l mailing list