[Koha-patches] [Bug 5379] Pull Request

Chris Nighswonger cnighswonger at foundations.edu
Thu Nov 11 18:20:01 CET 2010


 On Thu, Nov 11, 2010 at 12:03 PM, Colin Campbell <
colin.campbell at ptfs-europe.com> wrote:

> On 11/11/10 16:44, Galen Charlton wrote:
>
> > An undefined value is a clear indication that something went wrong; 0
> > in this context would be just another magic value.  Magic values are
> > to be avoided, even if the magic value in question is 0.
> >
> > Consider
> >
> > $borrowernum = AddMember(...);
> >
> To reinforce the point 0 could be passed back as valid data. (You can
> make mysql start its serial assignments from 0. Why you would want to I
> dunno ). Using undef to return an error leads to the route of least
> surprise and identifying and rectifying any code that is trying to use
> that as a value is usually straightforward.
>

So then to correct the discrepancy introduced by now interpreting undef as
an error, the current callers should be corrected to understand an undef
return as a "problem?" (ie. add error-handing)

As an aside: This discussion leads me to wonder where the wisdom of
returning error/exit "codes" is if we are saying we have a dislike for
"magic" numbers?

Kind Regards,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20101111/549e4402/attachment.htm>


More information about the Koha-patches mailing list