[erlang-bugs] erl_eval passes invalid argument to try clauses

José Valim <>
Mon Dec 31 16:13:20 CET 2012


According to the Erlang Abstract Format, a catch clause for try expressions
expects three arguments: the kind (which is an error, exit or throw), the
value (which is usually matched against) and a third undocumented argument
which is a cons list.

Taking a quick look around shows that this cons cell contains the
stacktrace and a number:

https://github.com/nox/otp/blob/master/erts/emulator/beam/bif.c#L1325

Which I was able to verify in practice.
This seems to work fine except that erl_eval does not pass a cons cell as
the third argument but only the stacktrace:

https://github.com/erlang/otp/blob/maint/lib/stdlib/src/erl_eval.erl#L786

In theory, since an Erlang developer cannot specify this third argument
using Erlang syntax, this difference does not actually matter. But in
practice part of the Erlang/OTP stack may actually rely on this third
argument, so I have decided to report this as a bug.

In any case, I would be interested to know the purpose of this third
argument.
Is it meant to be internal to the Erlang VM or should it be documented?

Thank you and happy new year!


*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Lead Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20121231/aeb4aef5/attachment.html>


More information about the erlang-bugs mailing list