-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
featureNew feature or requestNew feature or request
Description
Summary
Today we have find methods which returns a successful observer only if the value is already stored.
Idea would be to add a get counterpart which would always suceeds. This would allow to declare an observer even if the value is not yet present.
To be consistent
find(named:)would be renamedget(named:)as aliases never fail
Basic Example
identityMap.find(Foo.self, id: 1) // returns nil because value is not stored yet
identityMap.get(Foo.self, id: 1) // returns an Observer even if value is not stored. Might never receive any value if Foo(id:1) is never stored
identityMap.store(Foo(id: 1, title: "hello world")) // observer is notifiedUnresolved questions
Implementing such feature would require refactoring on how observers are handled currently: for now observer is tightly tied with the presence of the value in IdentityMap.
We would need a way of declaring such an observer even when value is not stored yet.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or request