ok or true?
Robert Virding
robert.virding@REDACTED
Mon Feb 23 23:07:00 CET 2004
----- Original Message -----
From: "Vance Shipley" <vances@REDACTED>
Sent: Sunday, February 22, 2004 8:02 PM
Subject: Re: ok or true?
> I would expect a function which returns true to have only
> one other possible return value; false. It is my observation
> that most functions which always succeed return true. I
> would find a function which returned true or {error, Reason}
> to be quite odd.
Correct. True and false are boolean values and should only be returned if
the return value is a boolean value. Otherwise use ok and error/{error,...}.
It was a bad design decision that many BIFs and library functions return
true or false to signify success and error. We weren't thinking straight
when we did that.
Robert
More information about the erlang-questions
mailing list