ok or true? (fwd)

Robert Virding robert.virding@REDACTED
Mon Feb 23 23:12:46 CET 2004


----- Original Message ----- 
From: "Ulf Wiger" <ulf.wiger@REDACTED>
To: <erlang-questions@REDACTED>
Sent: Monday, February 23, 2004 1:10 PM
Subject: Re: ok or true? (fwd)


> On Mon, 23 Feb 2004 12:45:44 +0100 (MET), Kostis Sagonas
> <kostis@REDACTED> wrote:
>
> > Thomas Lindgren <thomasl_erlang@REDACTED> 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.

It would have been much better. We made a mistake. I cleaned up the
interface a bit in dict.

Robert

P.S. Perhaps we should change? :-)





More information about the erlang-questions mailing list