[erlang-questions] How do I elegantly check many conditions?
Tue Mar 24 22:58:38 CET 2009
On Tue, Mar 24, 2009 at 10:08 PM, Attila Rajmund Nohl <
> 2009/3/24, Hynek Vychodil <>:
> > code
> > ok = is_new_email1(Email).
> > doesn't looks like same amount of code
> > try is_new_email2(Email) catch throw:email_in_use -> email_in_use end.
> > First one turns return value to exception, second one turns exception to
> > return value. Second one seems more code, does not?
> The beauty of execption handling is that you don't have to handle the
> exception where it was thrown. So in real code the second would be
> something like
> checks() ->
> And the catch would be at the call of checks().
And again, you assume how I will use your function. It's wrong! You avoid me
to make case when I know what to do.
--Hynek (Pichi) Vychodil
Analyze your data in minutes. Share your insights instantly. Thrill your
boss. Be a data hero!
Try Good Data now for free: www.gooddata.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions