[erlang-questions] When to return {ok, Value} or just the Value

Ulf Wiger ulf@REDACTED
Sun Nov 13 09:11:05 CET 2011

All success values must be clearly distinguishable from the error values.

E.g. lists:keyfind/3 will only return tuples as success values, so the error value can be 'false' (esp. since we have  no useful information about _why_ the object wasn't found).

Ulf W

Ulf Wiger, Feuerlabs, Inc.

13 nov 2011 kl. 01:35 skrev Steve Davis <steven.charles.davis@REDACTED>:

> Is there a rule-of-thumb guidance as to when it is the right "time" to
> return {ok, Value} and when to return just the raw value.
> Both are valid approaches according to the coding guidelines. The
> libraries do both.
> All and any comments/observations appreciated.
> best,
> /s
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list