Giter Club home page Giter Club logo

Comments (7)

fonsp avatar fonsp commented on May 16, 2024

This can be fixed if we turn run_reactive! into a recursive function: at the end of one evaluation, we can check whether any globals were assigned a reactive function, and treat them accordingly. @malyvsen

from pluto.jl.

malyvsen avatar malyvsen commented on May 16, 2024

I'd rather fix that by simplifying our model: we could treat variables and functions alike. Each varfunc would have a SymbolsState which is resolved when that varfunc (turning out to be a function!) is called. This could also work for getters, if Juia had getters - this thinking can be useful when we make Pluto.py ;)
In your example, g would have its SymbolsState copied from f (or, better, just being a reference to it) - so the call to g would be correctly identified as depending on y.

from pluto.jl.

fonsp avatar fonsp commented on May 16, 2024

What should happen with g = rand(Bool) ? f : identity?

from pluto.jl.

malyvsen avatar malyvsen commented on May 16, 2024

Good point! Seems like the SymbolsState shouldn't be copied - each varfunc should have a set of references to SymbolStates that it inherits from - and actually, those should just be the variables that are referenced when g is assigned to, I think?
I'll modify the example a bit for clarity, let's say we have g = rand(Float64, x) < .5 ? f : h - then g should inherit from all of x, f, h. This way, we might end up doing a bit too many updates, but I'd argue that, in the reactive paradigm, g simultaneously depends on f and h because there is no knowing which of the two it'll be after a re-run. As for inheriting from x - oh well, this isn't perfect :/ But we'll never end up updating too few cells this way so it's safe, though suboptimal.
To truly solve this problem, we would need to attach things to the variables themselves, I guess.

from pluto.jl.

fonsp avatar fonsp commented on May 16, 2024

That sounds like a good solution! It makes sense to derive reactivity just from syntax, and not from code evaluation.
Why should g not inherit from x?

from pluto.jl.

fonsp avatar fonsp commented on May 16, 2024

Would also make lambda functions reactive

from pluto.jl.

fonsp avatar fonsp commented on May 16, 2024

This is now a testset 🐸

It also meant reversing #25, recursion among functions now needs to be contained in a single cell, using a begin ... end block. There was no way to make it work within the paradigm.

from pluto.jl.

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.