[Bioperl-l] For CVS developers -potentialpitfallwith"returnundef"

Heikki Lehvaslaiho heikki at sanbi.ac.za
Fri Jun 2 07:52:07 UTC 2006


I've started going through the files that have 'return undef' lines.
I'll report back later.

Initial impression is that there are a few cases where the context indicates 
list to be returned but failure returns an explicit undef. I'll fix those.

Most of the cases are much more ambiguous. Even when documentation says the 
failure returns undef, it is clearly meant to mean false. In most cases 
documentation does not comment on return value at all. Luckily the context is 
almost always scalar and therefore it does not matter too much.

I seem to be changing 'return undef' to plain 'return' a bit overzealously, so 
do not take it personally.

	-Heikki

On Thursday 01 June 2006 19:46, Chris Fields wrote:
> ....
>
> > > Again, didn't do that.
> >
> > I'm very sorry that I allowed the ambiguity, but my comments were
> > certainly not directed at your recent changes to Bio::Restriction::IO.
> > In fact, I put in the above * comment to exclude your changes from my
> > discussion; you changed the docs because the code never did what they
> > said they did (the docs were bad). That's fine (good!). My comments were
> > a general point, slightly directed at the idea of changing all the
> > return undef;s - changing the code so that it no longer matches the docs
> > of a previously working method. That's what I think is bad. Though in
> > this particular case it shouldn't make any difference at all.
>
> Agreed.  In any case, if tests have been properly set up then they should
> catch problems.  This is, of course, if they are properly set up.
>
> Chris
>
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

-- 
______ _/      _/_____________________________________________________
      _/      _/
     _/  _/  _/  Heikki Lehvaslaiho    heikki at_sanbi _ac _za
    _/_/_/_/_/  Associate Professor    skype: heikki_lehvaslaiho
   _/  _/  _/  SANBI, South African National Bioinformatics Institute
  _/  _/  _/  University of Western Cape, South Africa
     _/      Phone: +27 21 959 2096   FAX: +27 21 959 2512
___ _/_/_/_/_/________________________________________________________



More information about the Bioperl-l mailing list