Hi! I’ve been diving deeper into Elixir recently and reading through some of the guides and docs about Processes and Supervisors. After reading Dynamic supervisors - The Elixir programming language and comparing the docs from Supervisor — Elixir v1.13.4 and DynamicSupervisor — Elixir v1.13.4 I’m not sure I fully grasped the advantages of DynamicSupervisors.
I think the confusion is mainly because I’ve seen that both modules have the same function to start a child “dynamically”: Supervisor.start_child/2 and DynamicSupervisor.start_child/2. However, every guide I read, states that DynamicSupervisors’s main purpose is to add children to the supervision tree dynamically. What am I missing here?
There’s an example in this code base that shows a Supervisor adding children dynamically as well, so I’m not sure I understand the advantages of one over the other.
PS.: Not directly related to the topic, but I also notice that Supervisor.child_spec/2 and DynamicSupervisor.child_spec/1 have some different semantics that seems not documented. The latter doesn’t allow us to pass the module and uses the name option to define the spec id.






















