david at cantrell.org.uk
Fri Jul 13 13:10:36 BST 2007
On Thu, Jul 12, 2007 at 12:28:56PM -0400, Matt Sergeant wrote:
> David Cantrell wrote:
> >On Wed, Jul 11, 2007 at 05:01:02AM -0700, Ovid wrote:
> >>And if the end-user forgets to check a return value, or checks it
> >>incorrectly (there are plenty of subtle ways this can happen), this
> >>returning false fails. I only want to see code returning false if the
> >>failure is safe to ignore. Otherwise, I want a proper exception.
> >With that in mind, what do you think of my practice in Number::Phone et
> >al of returning 1 to mean "yes" (eg yes, this is a mobile number), 0 to
> >mean "no" (no, it's not a mobile number) and undef for "dunno"?
> That's not error handling, that's a booleanish function. Returning "no"
> isn't an error condition.
No, really? Your grandmother is over there --> wanting to know how to
The point is that both 0 and undef are false, and so if the user isn't
careful about checking their return values that could lead to errors.
David Cantrell | top google result for "topless karaoke murders"
All children should be aptitude-tested at an early age and,
if their main or only aptitude is for marketing, drowned.
More information about the london.pm