[erlang-questions] spawning processes and passing arguments

Richard Carlsson richardc@REDACTED
Fri Feb 20 23:07:56 CET 2009


deepblue wrote:
> I keep running into this. I want to spawn processes and pass arguments
> to them without using the MFA form (module/function/arguments), so
> basically without having to export the function I want to spawn with
> arguments. I've gotten around this a few times using closures(fun's)
> and having the arguments just be bound values outside the fun, but its
> limiting my code structure... I've looked at the docs and spawn only
> has the regular spawn/1 and the spawn/3 form, nothing else...

By "using closures", I hope you mean something like this:

Pid = spawn(fun () -> any_function(Any, Number, Of, Arguments) end)

How would that be limiting to your code structure?

     /Richard



More information about the erlang-questions mailing list