ReactiveX/RxSwift

Why not adopt ObserverType for Relays?

geonu1109 opened this issue · 3 comments

Relays such as BehaviorRelay and PublishRelay included in RxRelay play a role in accepting and emitting values like RxSwift’s Subject, right? Although Relay can not handle all RxSwift events, adopting ObserverType will bring convenience to various implementations. Some people may be concerned about how to handle error or complete events, but I think we can do that by following the way Binder, which had the same problem, adopted ObserverType. What do you think?

Subjects [and Relays] provide a convenient way to poke around Rx, however they are not recommended for day to day use.
-- Introduction To Rx

I'm not sure it's a good idea to make something that isn't recommended for day to day use, more convenient.

Hey @geonu1109,
We had a lengthy discussion about this here:
#1551 (comment)

I suggest reading it and commenting here again if you have any questions./

@freak4pc Thanks for the good discussion. Considering type safety, it would be correct not to add it. There is already an alternative called Subjects. To say that Binders are dangerous at runtime would be a departure from the current discussion.