Exception Handling
Matt Sergeant
msergeant at messagelabs.com
Thu Jul 12 17:28:56 BST 2007
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.
Matt.
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
More information about the london.pm
mailing list