catch not an rvalue

Lennart Öhman <>
Tue Feb 19 17:32:36 CET 2002


Try:

5>X=(catch 22).
22
6>

/Lennart

Hal Snyder wrote:
> 
> 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

-- 
-------------------------------------------------------------
Lennart Ohman                   phone   : +46-8-587 623 27
Sjoland & Thyselius Telecom AB  cellular: +46-70-552 6735
Sehlstedtsgatan 6               fax     : +46-8-667 8230
SE-115 28 STOCKHOLM, SWEDEN     email   : 



More information about the erlang-questions mailing list