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

Possible simplification of the lifecycle of observers #2

Open
mchakravarty opened this issue Oct 9, 2016 · 0 comments
Open

Possible simplification of the lifecycle of observers #2

mchakravarty opened this issue Oct 9, 2016 · 0 comments

Comments

@mchakravarty
Copy link
Owner

The lifetime of an observer (i.e., time until being unregistered) is currently determined by the context object passed to the observe(withContext:observer) call and facilitated by the WeakApply struct it is turned in. As an alternative, we might use the Observation object produced by observe(withContext:observer) by keeping it in a WeakBox in the observers array of Changing<Value>.

This ought to simplify matters as we can get rid of explicitly mentioning context objects in the API (they can just be weak captures of the observer closures).

What would the impact of this change be on how chains of combinators are kept alive?

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

No branches or pull requests

1 participant