Skip to content

Possible simplification of the lifecycle of observers #2

@mchakravarty

Description

@mchakravarty

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions