[erlang-questions] Inconsistent catch behaviour

Ulf Wiger ulf.wiger@REDACTED
Thu Jun 18 10:26:41 CEST 2009


 From the Reference Manual, Ch 6.18:

Note that catch has low precedence and catch subexpressions often needs 
to be enclosed in a block expression or in parenthesis:

3> A = catch 1+2.
** 1: syntax error before: 'catch' **
4> A = (catch 1+2).
3

BR,
Ulf W

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.
> 
> ?
> 
> Cheers,
> Adam
> 
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
> 


-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com


More information about the erlang-questions mailing list