Inconsistent catch behaviour

mats cronqvist masse@REDACTED
Wed Jul 1 12:05:27 CEST 2009


Kostis Sagonas <kostis@REDACTED> writes:

> Adam Lindberg wrote:
>> Hi!
>>
>> How come I can write:
>>
>> 1> catch 1 + a.
>> 2> case catch 1 + a of A -> A end.
>> 3> A = (catch 1 + a).
>>
>> and even
>>
>> 4> catch 1 + a.
>> 5> A = v(-1).
>>
>> but not
>>
>> 4> A = catch 1 + a.
>
> Ulf Wiger has already answered this question, but I want to ask a
> different one.  Why should one bother these days with catch (even
> mention it on this mailing list) when try-catch is available?

  If you don't care about the result. E.g. 

catch ets:delete(foo),

  to assert that the table foo no longer exists.

  mats


More information about the erlang-questions mailing list