catch not an rvalue

Hal Snyder hal@REDACTED
Tue Feb 19 17:21:57 CET 2002


Hope this isn't another RTFM, but I can't resist asking.
Am going through the puzzle box while home with the flu.

During prototyping, it would be nice to replace
  X = <risky expression>
with
  X = catch <risky expression>
but the shell (and compiler) don't like that.

Just wondering why the syntax error is happening.
Didn't see the answer in, e.g., Chap 6 of
 http://www.erlang.org/download/erl_spec47.ps.gz 

1>catch 22.
22
2> X=catch 22.
** 1: syntax error before: 'catch' **

but:

3> F=fun()->catch 22 end.
#Fun<erl_eval.19.30196098>
4> X=F().
22




More information about the erlang-questions mailing list