In Erlang is there a way reference the currently executing function)?
That would be useful to spawn an infinite loop:
spawn(fun() -> do_something, this_fun() end)
In JavaScript arguments.callee
does just that, see the specification on MDC.
Edit to answer a 'why would you do that': mostly curiosity; it is also useful to define a timer when prorotyping:
Self = self(),
spawn(fun() -> Self ! wake_up, receive after 1000 -> nil end, this_fun() end),
%% ...