Skip to content

Scala Publish #640

Closed
Closed
@headinthebox

Description

@headinthebox

The current Scala bindings for publish are as follows:

def publish: (() => Subscription, Observable[T]) = {
val javaCO = asJavaObservable.publish()
(() => javaCO.connect(), toScalaObservableT)
}

This has a couple of downsides

  • It forces every caller has to invent names for the two pieces, whereas they already have names given by the callee.

    val (foo, bar) = baz.publish()

vs

val bar = baz.publish()
bar.subscribe(..)
bar.connect

  • It hides the fact that publish returns a connectable observable, so you cannot call refcount.
  • Why split up a nice object into a tuple of unrelated things. Maybe that makes sense if you want to pass the two pieces around separately, but that is typically not the case of connectable observables.

If I don't hear anyone screaming loudly, I am going to change this to mimic the Java signature.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions