|
|
|
|
|
by Mitranim
3233 days ago
|
|
In my experience, most async operations fit very well within the small feature set of promises/futures, with only a few operators (map/all/race). Streams should be the optional next layer of abstraction, not the only layer of abstraction. They should be built on top of futures. I quite like how Tokio did it for Rust futures. [1] Not a fan of Rx and similar designs. There are also different types of observables to consider. Rx, xtream, Most.js, they're basically stream libraries. When doing GUI programming, it's more useful to have reactive units with a _synchronous_ data access, because it matches how you want to access the data when drawing your view (e.g. in React). I ended using observables that look like Clojure's atoms (see Espo: [2]), with a special adapter for React (see Prax: [3]). Observable libraries like Rx were useless for that use case. [1] Example of decent future/stream design: https://tokio.rs [2] Observables focused on synchronous access: https://mitranim.com/espo/#-atom-value- [3] React adapter for implicit reactivity, based on synchronous observables (impossible with async streams): https://mitranim.com/prax/ |
|