-
Notifications
You must be signed in to change notification settings - Fork 70
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
Successful evaluation for an undefined network #228
Comments
Hm. Let's digest the call to
but this invalidates the assumption that
and this invalidates the condition for This looks like a classic How does the model implementation behave for this example? Internally, it seems that the |
Question: is the Graph data structure meant to be a DAG? Its docs only mention being directed, but seems to have an API that relies on it being acyclic, too (e.g. If so, perhaps |
Yes, it's meant to be a DAG.
That would be nice — but we would have to detect that there is a cycle. 😅 This can be done with a depth first search, but that is an expensive operation in that it needs to visit all the vertices on the putative cycle. I'm currently not aware of an algorithm that keeps track of the transitive closure and can do incremental updates that are faster than this. 🤔 That said, it may be possible to detect the cycle while the |
@HeinrichApfelmus could you provide some guidance on where in the code one might find an |
That's a tough one. 🤔 The best I can do in a pinch is to point you to the documentation of observable sharing in the design document: https://github.com/HeinrichApfelmus/reactive-banana/blob/master/reactive-banana/doc/design/design.md . The issue is that the If you look at the implementation of The only viable solution is to reify the issue in the structure of the code somehow. In other words, one would probably need two distinct |
I believe the following FRP system has undefined behavior:
The problem is
onStart
is defined in terms ofonStateChange
, butonStateChange
is defined in terms ofonStart
. This is mutual recursion between events, and the documentation writesThat's not the case here, so this recursion isn't well defined. What concerns me is that it does run though! What we see in practice is:
This is quite confusing:
onStartManual
occurs, causingonStart
to occuronStateChange
occurs, moving the state from(Nothing, [])
to(Nothing, ["Hello"])
- this is expected.onStep
occurs, causingonStateChange
to change from(Just "Hello", [])
.onStart
should occur, so the state transition should really have been the union of bothonStep
andonStart
, so we'd expect to be at(Just "Hello", ["Won't see me!"])
. This doesn't happen, and we instead enter a state that I think is impossibleI wonder if it's possible to spot this impossible recursion and to crash. I would much rather things crash than enter strange states.
Reading old resources like https://stackoverflow.com/questions/7850389/can-reactive-banana-handle-cycles-in-the-network/7852344#7852344, I think
<<loop>>
would be a reasonable outcome, as would just spinning.The text was updated successfully, but these errors were encountered: