-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scala Adaptor Details #512
Scala Adaptor Details #512
Conversation
…iption (mirror Java package structure)
@headinthebox @samuelgruetter Please confirm the two of you agree on this and I'll merge. |
RxJava-pull-requests #437 SUCCESS |
Looks good. |
Found a small bug (copy & paste) object PublishSubject { We need to add as well (and have the above call this one). I use the above to force type inference object PublishSubject { |
2x exactly the same? |
@headinthebox I still don't understand what you mean with this comment |
This is a trick we often use in C#. You pass in a dummy "witness" of type T to help the compiler infer types. If you say PublishSubject() it will infer PublishSubject[Nothing] and you are forced tp write PublishSubjectT. I never want to write a concrete type anywhere. |
With the current code object PublishSubject {
def apply[T](): PublishSubject[T] = {
new PublishSubject[T](rx.subjects.PublishSubject.create())
}
} we can do the following: val s1 = PublishSubject[Int]() // inferred type of s1: PublishSubject[Int]
val s2 = PublishSubject() // inferred type of s2: PublishSubject[Nothing]
val s3: PublishSubject[Int] = PublishSubject() // also works What else do you want to be possible? |
So you want to write
because you prefer writing |
Scala Adaptor Details
With #503, some files were lost, so I added them again, and I also fixed many other details. There are no changes in functionality/inheritance, only "cosmetics". Except samuelgruetter@8567fcb : @headinthebox could you please confirm this one-line change?