try & error?

Mark Scandariato mscandar@REDACTED
Fri Oct 15 17:59:27 CEST 2004

Thanks! I just tried it in a compiled module and it works as advertised.

Richard Carlsson wrote:
> On Fri, 15 Oct 2004, Mark Scandariato wrote:
>>The manual says that erlang:error/1,2 produces exceptions of class
>>'error', but it doesn't seem to:
>>1> Tst = fun(F) ->
>>1>     try F()
>>1>     catch
>>1>         throw:T -> {'THROW', T};
>>1>         error:R -> {'ERROR', R};
>>1>         exit:R  -> {'EXIT', R}
>>1>     end
>>1> end.
>>Am I doing something wrong?
> Not really, but your fun-expression is not compiled,
> it is interpreted. And the interpreter apparently does
> not yet distinguish properly between exits and errors.
> (For bootstrapping reasons, the OTP folks want to be
> able to compile most of the system with the previous
> major release, and using try-expressions inside the R10
> libraries would mean they cannot compile it with R9.
> Although it might be possible to do something about
> this particular case in the coming R10-1, there will
> probably always be some "nonstandard" behaviour in
> interpreted code until the R11 major release.)
> 	/Richard
> Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
> E-mail: Richard.Carlsson@REDACTED	WWW:
>  "Having users is like optimization: the wise course is to delay it."
>    -- Paul Graham

More information about the erlang-questions mailing list