[erlang-questions] Package Support/Use

Samuel Rivas samuelrivas@REDACTED
Tue Nov 7 15:28:05 CET 2006


Thomas Lindgren wrote:
> >   With tagged values you _must_ handle the tagged
> > value, even if you
> > want to ignore error cases.
> 
> Note that, going in the other direction, you can also
> straightforwardly generate an exception from a
> returned tagged value (e.g., badmatch), which then can
> be handled by higher-level functions, etc. So, at
> least for Erlang, I'm not sure your argument is
> conclusive.

Sure you can, but it is a matter of simplicity.  If you try to handle
badmatches then you'd probably want to discern between {ok,
Value}/{error, Reason} badmatches and programming errors.  The former
could either be handled or not, the later must crash the application.

Anyway, you still have to extract the value from the tag-tuple

  {ok, What_I_Really_Wanted} = foo()

While without tags, foo() is just what you want.

As I wrote in other post, now the problem is saying "what you really
want".
  
  Regards
-- 
	Samuel



More information about the erlang-questions mailing list