Updownquark / ObServe

Powerful observable application utilities
MIT License
1 stars 2 forks source link

Open API Tasks #16

Closed Updownquark closed 2 years ago

Updownquark commented 4 years ago
Updownquark commented 4 years ago

I've added the allowInexactReverse method in the new Transformation API. It is only allowed with mapping, not combination, because of some surprises I encountered when attempting to test it. These are commented on and documented in the source, but I'll reproduce it here for posterity.

In distinct managers deriving from inexact-mapped collections, values may be added as other than the actual argument. To account for this, the map used to store values must be aware of this condition. This is done by using the mapping equivalence in this particular case. However, if a value used in a combination is changed, the equivalence would then change, potentially corrupting any sets and maps created with it.

Updownquark commented 2 years ago

(In reference to above comment regarding the strict mapping task)

However, this problem only exists for collections. Values, which now use the same transformation API, should not have any problems with equivalence, so they should not, as they are now, be prevented from using inexact matching for combination.

Updownquark commented 2 years ago

I'm going to mark the ObservableSet dynamic repair task as complete. The ObservableSet supports repair any time a value is changed. If there is some value or condition that can possibly affect value storage in the set, a flow.refreshOn() should be used underneath (before) the distinct() call to keep the set correctly stored. Exposing an explicit call to effect repair is somewhat problematic with the Observable API because of the support for unmodifiability. So I think the best solution to to just keep the current status quo, which is to ignore repair calls.

Updownquark commented 2 years ago

There are some very difficult problems with making ObservableMultiMap.values() observable. In particular, ObservableCollections must be indexable. The core event they fire contains the index of the added/removed/changed element. Since values() combines elements from several collections, it's very difficult to access the index of one element in the whole values() collection without iterating over each previous multi-entry and adding up the sizes. There's not a very good accounting method I can think of to do this quicker.

For now, I'm giving up on that and marking this issue closed, since the others are done.