|
2 | 2 | TODOs for Scala Adapter
|
3 | 3 | -----------------------
|
4 | 4 |
|
5 |
| -This is a (probably incomplete) list of what still needs to be done in the Scala adaptor: |
| 5 | +This is a (probably incomplete) list of what still needs to be done in the Scala adaptor. |
| 6 | + |
| 7 | +TODOs which came up at the meeting with Erik Meijer on 2013-10-11: |
| 8 | + |
| 9 | +* Rename the factory methods in `object Observable`, considering that the most important is the one taking an `Observer => Subscription` function (the "king" according to Erik). Thunk to Subscription conversion (?), also consider Jason's [comments](https://github.com/Netflix/RxJava/commit/c1596253fc5567b7cc37d20128374d189471ff79). A useful trick might also be to have `apply(T, T, T*)` instead of just `apply(T*)`. |
| 10 | +* Factory methods for observables and instance methods should take implicit scheduler, default is different per method (Isn't this a contradiction? In other words: If I call a method without providing a scheduler, should the default scheduler be used or the implicit that I provided?) Find in .NET source the list of which schedulers goes with which operators by default. If no other default, use NewThreadScheduler. Note that there are methods in Scala Observable which should have an overload taking a Scheduler, but do not yet have it! Also remember Erik saying that he would like to "minimize magically injected concurrency". |
| 11 | +* Bring `BooleanSubscription`, `CompositeSubscription`, `MultipleAssignmentSubscription` to Scala, `compositeSubscription.subscription = ...`instead of setter method, add on `CompositeSubscription` should be `+=` |
| 12 | +* Convert executor to scheduler |
| 13 | +* Java Scheduler methods take `state` arguments (they were needed to schedule work on a different machine, but are now considered a bad idea). Remove these `state` arguments from all Scala schedulers. |
| 14 | +* Check if TestScheduler added in 0.14.3 is sufficient |
| 15 | +* Infinite Iterables: the java Observable.from version unfolds an iterable, even it is infinite. Should be fixed in java. |
| 16 | +* subscribe methods: There are many overloads, but still not all combinations one might need. Make this nicer and complete, maybe using default arguments. Also try to make sure that `subscribe(println)` works, not only `subscribe(println(_))`. `foreach(println)` works on collections, but not on `subscribe(println)`, because subscribe is overloaded. |
| 17 | +* Currently all Swing examples use Swing directly, without using the Scala wrappers around Swing. Make sure that everything is nice if the Scala wrappers around Swing are used, eg `Reaction { case clicked: ButtonClicked => … }` -- avoid default case, check out the hooks for partial function applyOrElse to avoid double pattern matching |
| 18 | +* There are no examples yet using `async`, but `async` will be used in the course. Write examples and check if everything works as expected when combined with `async`. |
| 19 | +* Futures: For the moment, just add a Future->Observable converter method to `object Observable`. Later, think if `Future[T] extends Observable[T]`. |
| 20 | +* Operator `delay`: Once Erik has commented on [this](https://github.com/Netflix/RxJava/pull/384), make sure this operator is added accordingly to RxJava and then to RxScala |
| 21 | +* go through Erik's code that he showed at the meeting and check if everything can now be done nicely |
| 22 | +* get Erik's slides from the course and check if they are compatible with the library |
| 23 | + |
| 24 | +Some more TODOs: |
6 | 25 |
|
7 | 26 | * Integrating Scala Futures: Should there be a common base interface for Futures and Observables? And if all subscribers of an Observable wrapping a Future unsubscribe, the Future should be cancelled, but Futures do not support cancellation.
|
8 | 27 | * Add methods present in Scala collections library, but not in RxJava, e.g. aggregate à la Scala, collect, tails, ...
|
9 | 28 | * combineLatest with arities > 2
|
10 |
| -* Implicit schedulers? |
11 | 29 | * Avoid text duplication in scaladoc using templates, add examples, distinction between use case signature and full signature
|
12 |
| -* other small TODOs |
| 30 | +* other small TODOs in source code |
| 31 | +* always: keep Scala Observable in sync with Java Observable |
| 32 | + |
| 33 | + |
| 34 | +### Appendix: |
| 35 | + |
| 36 | +`println` example: |
| 37 | + |
| 38 | + List(1, 2).foreach(println) |
| 39 | + Observable(1, 2).toBlockingObservable.foreach(println) |
| 40 | + |
| 41 | + Observable(1, 2).subscribe(println) // does not work |
| 42 | + |
| 43 | + class Ob[+T] { |
| 44 | + def subscribe(onNext: T => Unit) = ??? |
| 45 | + } |
| 46 | + val o2 = new Ob[Int] |
| 47 | + o2.subscribe(println) // works |
13 | 48 |
|
14 | 49 |
|
15 |
| -(Implicit) schedulers for interval: Options: |
16 | 50 |
|
17 |
| -```scala |
18 |
| -def interval(duration: Duration)(implicit scheduler: Scheduler): Observable[Long] |
19 |
| -def interval(duration: Duration)(scheduler: Scheduler): Observable[Long] |
20 |
| -def interval(scheduler: Scheduler)(duration: Duration): Observable[Long] |
21 |
| -def interval(duration: Duration, scheduler: Scheduler): Observable[Long] && def interval(duration: Duration): Observable[Long] |
22 |
| -```` |
|
0 commit comments