ok or true? (fwd)

Ulf Wiger <>
Mon Feb 23 13:10:33 CET 2004


On Mon, 23 Feb 2004 12:45:44 +0100 (MET), Kostis Sagonas 
<> wrote:

> Thomas Lindgren <> wrote:
>  >
>  > > In general you should stick to regular return values
>  > > like
>  > >
>  > >     {ok, Val} | {error, Why}
>  > >
>  > >     {value, V} | error
>  > >
>  > > for the same reason
>  >
>  > Case in point:
>  >
>  >       lists:keysearch -> {value,X} | false
>  >
>  > Argh. Oh well, one can always wrap such madness.
>
> I guess list:keysearch HAS to wrap its result, so that it can
> also return the atom 'false' or 'error' or anything similar.

Yes, but then

   {found, Value} | not_found

would have been better, or (debatable)

   {true, Value} | false.

/Uffe
-- 
Ulf Wiger, Senior System Architect
EAB/UPD/S

This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.




More information about the erlang-questions mailing list