raquo / Airstream

State propagation and event streams with mandatory ownership and no glitches
MIT License
246 stars 28 forks source link

How to use or override protected[airstream] members when extending observables? #79

Closed raquo closed 3 years ago

raquo commented 3 years ago

When extending Observable you need to provide an implementation for topoRank. But it's protected[airstream], which is annoying, because you either need to make that field public (ew), or put your subclass into the com.raquo.airstream package (double ew).

Instead what we should do is make topoRank simply protected (without [airstream]), and offer a private[airstream] def topoRank(o: Observable[_]): Int on the Observable companion object, or something like that.

Now, there are a bunch of other methods which are protected[airstream] and also have a concrete implementation. This includes tryNow, now, onNext, onError, onTry. I'm not sure if you can call them or even override them from your subclass. I think I need to fix those too, similarly to topoRank.