Recover from cyclic include in lazy-input example. #432
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A potential fix for file cycles in the lazy-input example. This one I'm much, much less sure about. Conceptually, you should be able to have mutually referential files and cycle breaking should only apply at the summation level. This seems to be an issue with the lazy input approach, so I'm curious of the intended approach here.
In a "normal" program you might handle this with a top-level worklist that is populated as you process files and discover dynamic dependencies. Tri-state recursion (unloaded -> loading -> loaded) with cycle breaking would be an option too. That second option seems more congenial to Salsa's way of doing things. When doing it manually, you might do the cycle breaking by registering a file id when transitioning unloaded -> loading (the first time a file is discovered) and then any subsequent call to load the same file would truncate the cycle by returning the file id. However, that is inherently stateful (e.g. you haven't finished loading the file contents when you register the file id initially) and I'm not sure if it's possible in Salsa.
Instead of pontificating further, I thought I'd just bring up this issue and use this mock fix (not really a fix) as a discussion starter.