[erlang-questions] variable propagation in try

Peti Gömöri gomoripeti@REDACTED
Thu Jun 28 12:08:13 CEST 2018


Hello,

I understand that passing variables between different blocks of a try catch
expression is mostly unsafe, because in case of expressions it is not
guaranteed that the variable binding actually happened.

But why using a variable in a clause after "of" that is bound in the block
after "try" is marked as unsafe by the compiler?
For example:

```
f() ->
    try
        {A, B} = a:b(),
        A
    of
        ok ->
            B %% unsafe ???
    catch _:_ ->
            a:b()
    end.
```

thanks
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180628/85ab77c7/attachment.htm>


More information about the erlang-questions mailing list