> > I think the child_spec could take arguments that are a merged form of both > arguments to start_link and to the supervisor spec. How would it look like? > > GenServer.child_spec(__MODULE__, arg: [arg], restart: transient, name: > Foo) >
Unfortunately this does not solve the problems mentioned in my last e-mail. :( If I change the name: Foo when calling child_spec, it won't be reflected until the *supervisor* is restarted. However, if we have two distinct steps, child_spec and start_link, anything done in start_link is reloaded. Because those two abstractions happen in very distinct moments and are called by different processes, I really really think we cannot mix the two different concerns without introducing drawbacks. Those drawbacks were not clear initially though, we had to think it through after your proposal. :) > I think it is true. Let's see an example: here's the application from the > mix & OTP tutorial refactored to take advantage of the proposal. No > start_link required. I also added some comments to explain the code. > > https://github.com/michalmuskala/kv_umbrella/commit/ > 62bc49d21bbb93fa4e926ad7f7f41388fc978f83 > > > Additionally here are the tests refactored to take into account the > start_child proposal: > > https://github.com/michalmuskala/kv_umbrella/commit/ > 753680541f1384c6d756a6550fc55089c507818d > To be clear, I agree we would be able to remove start_link from *your codebase*. However, you can't remove it from Supervisor, GenServer and friends because there are many situations you would still need them (for example, to start a Supervisor in IEx that will allow you to start a given child_spec. -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4LTE%3DmFmUq_GK0yUbg56%2BNCNE1oVqStaCni6GtEDS_7MA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
