It's also nicely fast compared to the old-Syndicate version :-)
There are still some problems with parameters in cross-ds relaying;
the symptom is #f for (current-facet) at some point, leading to some
sprites that don't get retracted (!).
The `add-endpoint!` call is changed in two ways:
- the old `assertion-fn` has become `update-fn`, yielding both
an assertion *and* an optional handler, because if the handler
depends on a field which changes, previously the handler wasn't
being updated
- a new parameter, `dynamic?`, can be set to #f (it's usually #t)
to ensure that the assertion and skeleton-interest are calculated
only once ever, and are not connected to the dataflow machinery.
The first change makes it possible for the `(later-than (deadline))`
pattern, where `deadline` is a field, to work; the second change makes
`during` and `during/spawn` work correctly in the face of field
updates.
We now explicitly track *committed* assertions of each actor in a new
field, `actor-cleanup-changes`. Each time a patch action is
*performed*, `actor-cleanup-changes` is updated. When an actor quits,
it enqueues a special new kind of action, a `quit` action.
When a `quit` action is performed, any remaining contents of
`actor-cleanup-changes` are processed in order to fully remove any
leftover assertions. (Leftover assertions will only arise in
exceptional cases: when some stop-script or facet boot-script raises
an uncaught exception.)
As part of this commit, we undo the effect of commit b207a07.
This repairs a bug regarding crashes in a new actor's boot-proc.
Previously, if boot-proc raised an exception, the initial assertions
would stick around forever. By changing adhoc-assertions to a bag
rather than a set, and putting the initial assertions in the bag, we
put them somewhere they are guaranteed to be processed during actor
termination, even when an exception is signalled during boot.
This is an API change wrt the previous Syndicate implementation:
assert!/retract! now have bag semantics, not set semantics. We can add
set-semantics APIs if we end up needing them, of course, layered on
top of the bag implementation.