[erlang-questions] Finding a way to get function name from local function reference
Wed Jan 21 10:35:38 CET 2009
On Wed, Jan 21, 2009 at 9:39 AM, Richard Carlsson <> wrote:
> This is due to a compiler implementation detail (broken, imho), where
> a local function reference "fun foo/N" is actually compiled by rewriting
> it as "fun (...) -> foo(...) end", which means that the name you get
> from fun_info() is the generated internal name for the new anonymous
> function. The name "foo" is hidden and there is nothing you can do
> to get hold of it. It would be nice if the compiler was changed to
> generate direct references instead of wrapping them like this.
There is (or used to be) a subtle detail in the run-time systems that makes it
necessary to introduce a wrapper function. At the moment I don't
remember exactly what the detail is (was), but I'll investigate and see
if I can do something about it in R13.
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-questions