Skip to content
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

Spell out ordering of sources/sinks sets #203

Open
prophile opened this issue Apr 29, 2024 · 0 comments
Open

Spell out ordering of sources/sinks sets #203

prophile opened this issue Apr 29, 2024 · 0 comments

Comments

@prophile
Copy link
Contributor

I think it would be better to be very explicit here rather than relying on implicit reference to the ES Set, specifically: that sources and sinks aren't semantically sets but arrays/lists (intrinsically ordered), and that we explicitly check their contents and don't re-add anything. There's some ambiguity as it's currently worded:

In the Typescript definitions, there's a comment:

        // Returns ordered list of all signals which this one referenced
        // during the last time it was evaluated.
        // For a Watcher, lists the set of signals which it is watching.

But it doesn't specify what order, just that it is ordered. Specifically this is order of first reference I think. For a Watcher the order isn't specified at all here but probably should be?

In the "Signal.Computed Internal Slots" section also:

sources: An ordered set of Signals which this Signal depends on.
sinks: An ordered set of Signals which depend on this Signal.

We should be clear about what this order is. This is more subtle because items can be individually removed, e.g. by Signal.subtle.Watcher.prototype.unwatch(...signals):

Remove this Watcher from that Signal's sink set.

If the same watcher calls watch on the same Signal.Computed it will be readded as a sink, but that leaves the order of sinks permuted from what it originally was.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant