3 ms·
The notion of hot versus cold for Promises/Futures doesn't make much sense, because you're not sharing a connection, but a result. In other words you're thinkin
by bad_user 10y ago
The notion of hot versus cold for Promises/Futures doesn't make much sense, because you're not sharing a connection, but a result. In other words you're thinking of memoization of the result. Also backpressure doesn't make sense when you're pushing a single result, as there's nothing left to apply backpressure for.
You mentioned Singles. I actually think Singles are terrible because they are observables. You see, while it's a poetic notion, the use cases are different. In particular, Futures tend to be used in tail recursive loops whereas observables are not used like that. So Futures can and must be stack safe (in flatMap), but Observables cannot be stack safe by definition (since you always have a last onComplete event).
As a disclaimer, I've been working on a Scala library inspired by ReactiveX, Scala, Cats, etc. And my Task (i.e. Single) does not inherit from Observable. Try doing this with Single: https://monix.io/docs/2x/eval/task.html#flatmap-and-tail-recursive-loops https://monix.io/docs/2x/eval/task.html#flatmap-and-tail-rec...
- deleted 10y ago[deleted]