Updownquark / ObServe

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

Re-write issues #9

Closed Updownquark closed 6 years ago

Updownquark commented 7 years ago

This is to keep track of issues I need to address as I rewrite ObServe.

Updownquark commented 7 years ago

Perhaps the filterMap mechanism could be expanded to include combination and (value-unspecific) refreshing in addition to caching.

Updownquark commented 7 years ago

Had a thought, may be garbage: Perhaps everything should be cached--all derived collections and values. The derived values would install a weak listener in the values they are derived from. The derived values would have a strong reference to the listener so that the listener is not gc'd while the derived value is reachable. But when the derived value is gc'd, the weak listener would remove itself (the next time it is called). No until observable would be needed.

If the builder pattern started on ObservableCollection.buildMap could be expanded to include combination, refreshing (value-specific as well), and generalized to ObservableValue, this caching would not be wasteful because the results of the derivation would not be middle-men, but useful values.

The builder could produce a structure that produces

The derived value or collection class would instantiate one of the first kind of structures and then one of the second kind per source element. This would maintain the cache and listeners and accessors would only need to reach into the cache. Only modification operations would need to reach into the source value.

flattenValues() could also be implemented in this way. Perhaps a flatMap() method could be added to the builder.

Implement sorted() using a SortedTreeList (need to create).

Perhaps withEquivalence(), filterModification(), takeUntil(), and unsubscribeOn() could all be implemented by the same class.

If all this could be done,

Need to think really hard about the changes() observables and make them very smart. Maybe add CollectionChangeType.moved

Updownquark commented 7 years ago

The things that are left to do in ObservableCollection

Updownquark commented 6 years ago

I think this can be closed. The testing check marks are obviously now accounted for by the super tester issue, #12. I have done some work to compress the spliteration and listening stacks, but I may do more later. Profiling will probably best be done using the super tester.