[erlang-questions] A problem with smart_exceptions

Mikage Sawatari mikage@REDACTED
Fri Jun 15 08:01:12 CEST 2007


Hello,

I encountered a problem when I used smart_exceptions in the
jungerl on Erlang R11B-5. Is there any work around for this?



A way to reproduce:

1. Install the smart_exception at:
   http://jungerl.cvs.sourceforge.net/jungerl/jungerl/lib/smart_exceptions/

2. Compile the following code:

---- exception.erl ----

-module(exception).
-export([test/0]).

test() ->
        try
                test2()
        catch
                Ex -> io:format("Catch ~p~n", [Ex])
        end.

test2() ->
        throw(exception),
        io:format("throwed exception~n").

---- exception.erl ----



Phenomenon:

The result differs depending on whether we use smart_exception or not.

$ erlc +'{parse_transform, smart_exceptions}' exception.erl && erl
-noshell -s exception test -s init stop
throwed exception

$ erlc exception.erl && erl -noshell -s exception test -s init stop
Catch exception

It seems when the smart_exception is in effect, "throw" statement
isn't executed and the computation falls through the next line.


-- 
-----------------------------------------------------------------------
SAWATARI Mikage (SANO Taku)
http://www.mikage.to/



More information about the erlang-questions mailing list