Giter Club home page Giter Club logo

Comments (4)

paldepind avatar paldepind commented on September 27, 2024 1

Hello @zyla. Thank you for asking such a great question.

Hareactive is purely functional FRP library and it is primarily intended to be used in a pure setting. Glitches have the effect that some functions end up being invoked more often than they should. But, if the function is pure and doesn't have any side-effects then this is not a big problem. It's not ideal but it's not a big deal. Therefore fixing it is not a huge priority right now.

That being said, we do definitely intend to fix this at some point in time. We'll probably end up doing a topological sort of the dependency graph to eliminate glitches. But, as of right now we are making large refactors of the implementation to improve performance and code clarity.

from hareactive.

paldepind avatar paldepind commented on September 27, 2024 1

Btw, another part of the reason why we haven't eliminated glitches yet is that we want to do it with the smallest performance overhead as possible. We've discussed implementing the topological sort such that the topological order computed while the dependency tree is being constructed and updated when new dependencies are added/removed. This will make maintaining the topological sort cheaper. But we need to get other internal features in place before we can do that.

from hareactive.

zyla avatar zyla commented on September 27, 2024 1

Sorry for the naive question - but is the test case above from this API, I don't see those functions listed?

@dakom This test is not included in the hareactive test suite. To see the effect, paste it into test/behavior.ts in the describe block.

(edited: messed up formatting)

from hareactive.

dakom avatar dakom commented on September 27, 2024

Sorry for the naive question - but is the test case above from this API, I don't see those functions listed?

Also, feel free to correct me if I'm wrong - but I believe glitches are an indication that something is off in the semantics or the implementation is buggy. For example, here's a live demo similar to the one above via RxJS (which is not FRP proper): https://codepen.io/dakom/pen/yoqyEK (change the html to switch between v4 and v5, the glitch actually manifests in different ways which is kinda scary)

More info from the book Functional Reactive Programming:

because Rx isn’t based on denotational semantics, it isn’t
truly compositional, and this is one of the requirements of FRP. One way in which this
manifests is the area of glitches. A true FRP system should be glitch-free.

from hareactive.

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.