-
Notifications
You must be signed in to change notification settings - Fork 9
Propagators: fix diamond-problem via dependency tracking #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Radul, “Propagation Networks: A Flexible and Expressive Substrate for Computation.”.
|
Nice! Can you spell out the loop semantics that are now supported? E g. is a propagator that writes into what it reads called again immediately until it reaches a fix point? What if the merge result is different from what it wrote? E.g. if there are two interlocked loops, but both get fed from outside as well, do computations first finish within before external data comes in, or is that undefined? (IOW, is there a sense of concentric loops, and what happens when they aren't clearly concentric?) FWIW, my previous assumptions were:
#113 implements this with a topological sort like so:
for nice concentric loops this should behave the same way, since they are themselves topologically sorted. when that's not the case, extra runs can occur, but i don't know how else it would be well-defined. i figure it practice those are cases that look like complex loops in the graph, but only one leg runs at a time anyway. (this isn't meant as a critique of the approach, just trying to compare notes) |
Also: - Change Cell.get() to Cell.value - Change State.next() to State.step() - Don't return new state from step if values are equal
An example of a graph cycle can be found in the tests: https://github.com/commontoolsinc/labs/pull/121/files#diff-1c61eca3f1104743ce34c8d18d757588bf67002cdde58742ed908ab27ebed257R94 The implementation is based on the notes in Radul Ch. 5.5, and works like this:
|
This makes state keyable... step one in making Cell<State<T>> pathable.
|
Closing out stale PRs, please reopen if this is relevant |
Following Radul, “Propagation Networks: A Flexible and Expressive Substrate for Computation”, Ch. 5.5, this PR explores state updates / resolving the diamond problem via tracking the causes of state changes using a vector clock that lives on the mergeable data structure.
TODO:
Cell<State<T>>in a facade that facilitates this use case a bit more ergonomicallyCellViewproxy that makes this all look like ordinary property mutationApproach
Benefits
.merge()method mechanism that already exists on propagatorsChanges
.poll().if(debug())statements for efficiency