[erlang-questions] Why have a supervisor behaviour?

Roger Lipscombe roger@REDACTED
Thu May 21 16:11:04 CEST 2015


I find myself writing a custom supervisor (because I need restarts to
be delayed[1]), and I find myself wondering why OTP has a supervisor
behaviour?

That is: why does it require us to provide the Module:init/1 function?
Surely we could just pass the restart strategy, child specs, etc. to
supervisor:start_link directly?

Is there something I'm missing, that I'm going to regret if I don't do
it the same way in my custom supervisor?

Regards,
Roger.

[1] http://erlang.org/pipermail/erlang-patches/2012-January/002575.html
discusses a supervisor with delayed child restart (and has some code),
but (a) it seems to have died a death, and (b) it's not exactly what I
need.



More information about the erlang-questions mailing list