Erlang: how can I reference an anonymous function from within the body? -


is currently a method of executing)?

This is an underwear endless loop:

  spawn (fun -) -> do_something, this_fun () end)  

In the JavaScript, arguments.callee does this, but see the specification.

To answer one 'why do you do this: mostly curiosity; It is also useful to define a timer at the time of prorotiPing:

  self = self (), spawn (fun () -> self! Wake_up, received after 1000 - & gt; Zero end, this_fun) in the end), %% ...   

Errang / OTP 17.0-RC1 In, you can use that nominated fun for:

  1> Self = self (), 1 & gt; Fun = funny this fan () - & gt; Self! Wake_up, receive after 1000 - & gt; Zero End, Jafan () End # Fun & LT; Erl_eval.44.71889879 & gt; 2 & gt; Eggs (fun). & Lt; 0.35.0 & gt; 3 & gt; Flush (). Shell pass wake_up Shell wake_up Shell wake_up found right  

In the earlier versions, there is no way to do this exactly. You can pass the function as an argument:

  self = self (), fun = funny (this fine) - & gt; Self! Wake_up, receive after 1000 - & gt; Zero (end) -> fun (fun) end, %% ...  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -