GithubHelp home page GithubHelp logo

Comments (7)

josevalim avatar josevalim commented on June 3, 2024 3

Dynamic supervisor is in master. What is left to be implemented is marked as TODO in the code.

from gen_stage.

michalmuskala avatar michalmuskala commented on June 3, 2024

Given the DynamicSupervisor is similar to :simple_one_for_one, wouldn't it be better if it accepted just a single child specification instead of a list with just one element? It is my understanding that it doesn't make sense to pass multiple specs there.

from gen_stage.

josevalim avatar josevalim commented on June 3, 2024

@michalmuskala yes, I was torn about this decision but I see benefits in keeping the return types the same for both supervisors (i.e. always a list).

from gen_stage.

sasa1977 avatar sasa1977 commented on June 3, 2024

What benefits do you see in using a list (which as far as I understand will always have to have exactly one element)?

Also, will we have the "module-less supervisor", i.e. something like: DynamicSupervisor.start_link(child_spec, supervisor_opts)?

from gen_stage.

josevalim avatar josevalim commented on June 3, 2024

@sasa1977 callback specifications, functions like Supervisor.Spec, anything else that works on childspecs will always expect the same type.

And yes, the module-less supervisor will be there.

from gen_stage.

sasa1977 avatar sasa1977 commented on June 3, 2024

The only such function I see there would be Supervisor.Spec.supervise, which I don't think makes sense for dynamic supervisors anyway. Not only because it accepts multiple children, but also because it takes a strategy as an option (which doesn't make sense for dynamic supervisors). You'd again need conditionals in the docs to describe how is this used for static vs dynamic supervisor, so I'd say it's better to separate the two implementations. The dynamic one could then require a single child.

The remaining two functions can be shared between both supervisors, as they are not concerned with the child specification.

I'm still confused about "anything else that works on childspecs will always expect the same type". What else is out there?

from gen_stage.

josevalim avatar josevalim commented on June 3, 2024

A strategy will still be required for dynamic supervisors. It will ship
only with :one_for_one but we may add others in the future.

If in a couple years we don't add another strategy, we can remove this
requirement. It is always better to start with such requirements because
removing them later on is backwards compatible. If we don't enforce a
strategy option now and add a new strategy in the future, we won't be able
to enforce the option, as it would be backwards incompatible, and we will
regret not being explicit today.

I don't have any examples today of other strategies we may add (if I did
this decision would be much easier ;)). It still does not change the fact
the strategy option will be required (for now).

José Valimwww.plataformatec.com.br
http://www.plataformatec.com.br/Founder and Director of R&D

from gen_stage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.