catch in assignment
Thu May 18 17:43:08 CEST 2000
Sean Hinde <> writes:
>Can anyone shed any light on the following behaviour:
>> A = catch 1.
>** 3: syntax error before: 'catch' **
>> A = (catch 1).
>It doesn't strike me as ambiguous to assign the result of a catch to a
No, it isn't ambiguous. The reason is that 'catch' is a prefix operator
which happens to have the same as '=' and '=' demands higher priority
on the right. You can write:
catch A = 1.
Yes, this could be solved by a hack to the parser, but I never thought
it was worth it. The REAL way to solve it would be to change 'catch'
so as not to be a prefix operator but to terminate with an 'end', but
it was to late for that (which would save begin .. end):
A = catch foo(X), bar(Y) end.
Robert Virding Tel: +46 (0)8 692 22 12
Bluetail AB Email:
Hantverkargatan 78 WWW: http://www.bluetail.com/~rv
SE-112 38 Stockholm, SWEDEN
"Folk säger att jag inte bryr mig om någonting, men det skiter jag i".
More information about the erlang-questions