[erlang-bugs] try..catch unsafe variable

Matt Handler <>
Thu Nov 6 02:59:06 CET 2008

using R12B-2

i've been staring at this but I can't figure out what is wrong with it:

test() ->
    try expression of
        Val -> Reply = value
        _:_ -> Reply = exception
    {ok, Reply, state}.

test2() ->
    Reply = try expression
                _:_ -> exception
    {ok, Reply, state}.

test() gives a compile error: "...variable 'Reply' unsafe in 'try' (line
test2() does not.  can anyone clear this up for me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20081105/310fdd10/attachment.html>

More information about the erlang-bugs mailing list