-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support for subscribing other callbags #10
Comments
@zebulonj any thoughts? |
This slipped through my radar. Thanks for re-upping it. I'll give it some thought today. |
@zebulonj may I bump this again? 😅 |
Ok. I follow your inquiry. When you say "support for subscribing other callbags directly" you're referring to the subject (for example) as a sink:
I've wrestled with this on my own. Superficially, it's a nice pattern. I find myself hesitating though when considering that without intermediating logic, this suggests that not only data, but also errors and completions would be passed to the target subject. Have you thought through the consequences of that? If the source to which the subject subscribes using your proposed overloading encounters an error, what should happen to the subject? Downstream from the subject? Have you thought about how you'd implement this overloading safely? |
I was thinking of treating given Callbag as a sink, which means passing down errors, termination signals, etc. This is perfectly mirroring the same behavior in RxJS, where a |
In RxJS, you can call
.subscribe()
on anyObserver
, including otherSubject
s for example. In callbag world, any callbag can be an observer as well, so it would make sense to add support for subscribing other callbags directly. This way, you could invokesubscribe()
on callbag subjects for example, mirroring similar behavior in RxJS.Here is a sample of how that would work. I could make a PR directly, but wanted to ensure that this is something that you do want to add before writing tests for it.
The text was updated successfully, but these errors were encountered: