Skip to content

Question about reactivity and side-effects #2011

Discussion options

You must be logged in to vote

Hey! Take a look at #564 and https://www.youtube.com/watch?v=IAF8DjrQSSk for some background.

In your example, Cell 1 is seen as a definition of x, and cells 2&3 are referencing x, and this is all the reactivity information that Pluto has. (Pluto's reactivity is syntax-based, not value-based.) This means that whenever you run cell 1, Pluto will also run cells 2 & 3. Pluto will probably run cell 2 before cell 3, because cell order is used as a tie-breaker in our algorithm.

So when you changed cell 1 to: x = Dict("key" => 42) and reran it, this triggered cell 2 to run (setting the value to 1), and then cell 3, returning 2.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fonsp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants