Skip to content
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

Connectable Observables #16

Open
davidwdan opened this issue Nov 8, 2015 · 6 comments
Open

Connectable Observables #16

davidwdan opened this issue Nov 8, 2015 · 6 comments

Comments

@davidwdan
Copy link
Contributor

I've implemented all of the connectable observables from RxJS. Since they're interdependent, it probably makes sense to handle them as one PR, but I can split them up if it's too much to review at once.

Before I create the PR, I need some feedback on the best way to handle the operators that can take a value or factory as the same argument. See:

https://github.com/davidwdan/Rx.PHP/blob/connectable_observables/lib/Rx/Observable/BaseObservable.php#L650
https://github.com/davidwdan/Rx.PHP/blob/connectable_observables/lib/Rx/Observable/BaseObservable.php#L697

Also, some of the tests are skipped because zip hasn't been implemented yet. @JMB3 is working on that.

@asm89
Copy link
Owner

asm89 commented Nov 8, 2015

@davidwdan Tricky.

One option could be only implementing the factory versions, because the other version can be created using the factory one, but not the other way around. On the other hand some cases get really awkward if we do it that way I guess (e.g. publishValue(callable $...) vs publishValue($value)).

If we implement both version we could have a slightly different name for one of the versions?

@davidwdan
Copy link
Contributor Author

I'm guessing that the vast majority of use cases in php will be without the factory. What if we only allow a subject for multicast and reverse the argument order for publishValue.

multicast(Subject $subject, callable $selector = null)
publishValue($initialValue, callable $selector = null)

If someone wants to use a factory, they can still use MulticastObservable. It's not ideal, but I think it's better than the alternative.

If needed, we can always add a new multicast operator, down the road.

@asm89
Copy link
Owner

asm89 commented Nov 9, 2015

@davidwdan I like it 👍 Let's figure out alternatives if someone comes by really wanting the factory support. :)

@davidwdan
Copy link
Contributor Author

The only one that needs an alternative is multicast. How about:

multicastWithFactory(callable $subjectSelector, $selector = null)

@asm89
Copy link
Owner

asm89 commented Nov 9, 2015

Should we just call $subjectSelector $subjectFactory if we go that route? I guess selector is more Rx-y..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants