[erlang-questions] Newbie question: function include/1 undefined

Donald Steven t6sn7gt@REDACTED
Mon Oct 3 11:28:28 CEST 2016


Thanks Richard and Jeff, much appreciated.


On 10/02/2016 11:14 PM, Richard A. O'Keefe wrote:
> (1) Your initialisation code can return a tuple or list of process IDs.
>
> (2) Your initialisation code can store the process IDs in the
>     process dictionary.  Each process has its own dictionary.
>
>     Self = self(),
>     Orbiter1 = spawn(fun () -> orbiter:start(Self, data(1) end),
>     ...
>     Orbiter16 = spawn(fun () -> orbiter:start(Self, data(16) end),
>     put(orbiter1, Orbiter1),
>     ...
>     put(orbiter16, Orbiter16),
>     ...
>     or even
>
>     Self = self(),
>     put(orbiters, [spawn(fun () -> orbiter:start(Self, Data) end)
>                   || Data <- orbiter_data()])
>
> (3) You could use the (per-node) global process registry in the
>     initialisation code
>
>     register(orbiter1, spawn(fun () -> ... end)),
>     ...
>
>     and then use orbiter1!Message later.
>
> This seriously looks like code that could be in another module
> without any preprocessor use at all.
>




More information about the erlang-questions mailing list