[erlang-questions] Supervision Tree

Bengt Kleberg bengt.kleberg@REDACTED
Wed Nov 28 11:34:35 CET 2012


First let me mention that I prefer to never mix call back code that runs
in a special process (in this case the supervision process) with code
used by other processes. So, start_link/0 is better off in another

Secondly, if you have a variable with _ first in the name the compiler
should not complain about it not being used. What is your compile

Last, _Args is the [] from supervisor:start_link/2


On Wed, 2012-11-28 at 12:23 +0200, Lucky Khoza wrote:
> Hi Erlang Developers,
> I'm actually trying to understand and compile the following module
> code, and i don't understand why the init/1 function takes an argument
> which it doesn't use at all, so when i try to compile the module it
> complains about the argument _Args because it's unused.
> May someone help me understand the use of this argument?
> -module(ch_sup).
> -behaviour(supervisor).
> -export([start_link/0]).
> -export([init/1]).
> start_link() ->
>     supervisor:start_link(ch_sup, []).
> init(_Args) ->
>     {ok, {{one_for_one, 1, 60},
>           [{ch3, {ch3, start_link, []},
>             permanent, brutal_kill, worker, [ch3]}]}}.
> Thanks for a lot for your help, i really appreciate it.
> Kindest Regards
> Lucky
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list