Coder Social home page Coder Social logo

Are subclocks generally available? about s HOT 4 CLOSED

adamhaile avatar adamhaile commented on June 1, 2024
Are subclocks generally available?

from s.

Comments (4)

ryansolid avatar ryansolid commented on June 1, 2024

To me the clear benefit of subclocks is being able to represent data in a more succinct and declarative manner. You build the rules in a much more universal way. You can still for the most part solve the same problem a different more specific and verbose way (like setting values to their rest state).

I'm actually interested by this question. I've been using fine grained libraries, like S(but not S), in production for the better part of the a decade but since in most libraries subclock scenarios are so detrimental to performance I just don't think about solving issues that way. So I'm interested in any concrete use cases.

EDIT: I think this is more for synchronicity than anything. Subclocks ensure consistency where just setting a value doesn't.

from s.

mrjjwright avatar mrjjwright commented on June 1, 2024

Are subclocks available in mobx? Does mobx just use one clock? Can you give me a simple example of where subclocks make things more declarative?

from s.

ryansolid avatar ryansolid commented on June 1, 2024

I'm not aware of anything like this in MobX, but I'm not a MobX expert.

As for declarative look at the example in the readme. By declarative I mean indicative of intent, since subclocks in this example are actually quite iterative. You get to write that the computation works a certain way to set only if value is 10 or less. You don't care anymore how it gets to 10, just that it will end up there. Now in a real scenario I'm sure the computation would be more complicated than tracking over the single value. What I'm saying is if you wanted to avoid a computation like that you'd need to basically only apply the stable state (in this case set it directly to 11) and mirror any other work the computation would have done. This might require specific scenarios to be considered where as the rule might just be simpler.

Re-reading the readme the intent though is more about synchronicity to ensure outside all reactions are seeing the same data. I'm used to thinking of libraries like this being event/subscription orientated, but the goal of S is more about correctness and synchronicity. So there are probably a slew of actual scenarios where this is relevant.

from s.

mrjjwright avatar mrjjwright commented on June 1, 2024

Thanks Ryan! I think I am facing an issue now where they might be useful.

from s.

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.