Closed back2dos closed 4 years ago
Under this new implementation I will have to manually implement the signals if I want to observe the add/remove activities?
How granular do you need the change notifications to be?
Currently I have some code that directly used the changes
signal to listen on the add/remove events of a Map. But now I guess I should really re-think that part...
Hmm, well, that's also possible. I don't mind adding some more granular notification, but I'd like to understand the use case to hit a decent sweet spot between flexibility and performance ;)
In a nutshell it is a Bluetooth LE library, I need to keep track of a list of currently visible peripherals nearby, and I need to be able to perform actions when one is discovered or gone.
Hmm, I see. Well, the more immediate problem is that you can't subclass ObservableMap
, because it's an abstract now ^^
@kevinresol Do you need the subclassing? It would be possible to expose the implementation and have something like this:
@:forward
abstract ObservableMapOver<K, V, Map:IMap<K, V>> {}
typedef ObservableMap<K, V> = ObservableMapOver<K, V, ObservableMapImpl<K, V>>;
// userland
class MapWithSparklesImpl<K, V> extends ObservableMapImpl<K, V> {}
typedef MapWithSparkles<K, V> = ObservableMapOver<K, V, MapWithSparklesImpl<K, V>>;
Not a huge fan though, especially since allowing inheritance always increases potential for conflict ^^
I don't think I liked subclassing but I guess I did so to get access to the private change signal. I think I can rework it.
Mostly, this is about drastically simplified
ObservableMap
/ObservableArray
. Attempts to fire changes granularly had way too much overhead and are relatively useless given that auto observables and bindings are good at avoiding unnecessary work. As a result, the data structures are much simpler and MUCH faster, e.g.:It's about 4 times slower than plain arrays and about 100 times faster than the previous version.
There's still some room for optimization, but my primary concern for now is proceeding with any breaking changes necessary before this gets to be a 1.0.0.