-
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
Added experimental to() method for fluent type conversions. #2971
Conversation
I second this PR. |
I would prefer if the Func1 were from OnSubscribe to O. There isn't really any reason that a conversion func should have to call subscribe. I would really like to build on top of this. I'll post a link with more examples shortly. |
I have been working on a proof of concept using a similar mechanism to the public interface MonoConversion<O, T> {
public O convert(OnSubscribe<T> onSubscribe);
} I would really like to be able to use this to method in a similar way. Here is a link to the project and an example implementation of a conversion. |
|
The |
I don't see why you'd want access to the OnSubscribe inside an Observable. |
Sorry, let me try to start from the top. I am trying to write an API for an extensible Observable that allows for more functionality than member methods and one-off lifted operators. I intend to use the So if someone were to write a class Observable that followed the same interface as the This also means that in order to use that conversion function for any other kind of observable (ParallelObservable, BiObservable, TemporalObservable, etc.) then someone would have to use a shim class to subscribe to the Observable or the function would have a concrete import to the Observable variant class so that it can reach in to access the |
I don't think this is even doable. For example the In addition, Observable is the base class for fluent operations with final methods and from API perspective, it is unfeasible and unnecessary to extract an interface for these methods: interface evolution isn't really possible in pre-Java 8. Even if both |
To convert from an |
Still I don't see the point. You can call |
I'm fine with having a conversion function call the |
@akarnokd thanks for hearing my feedback. Would you like for me to try and implement this? |
"Code wins arguments", so if you show me the code, I might be convinced. |
@stealthcode Do you have examples to show? I'm leaning towards merging this since it is marked as |
@benjchristensen yes please take a look at #3082. I had to make package visible static method encapsulating the work of |
I'm closing this PR since #3082 has been merged (which I find over-convoluted in contrast to this PR). |
@akarnokd I really do want to hear from you regarding implementation and design decisions. You had no comments regarding convoluted implementation before the pull request was merged. Do you want to comment or open an issue? |
See #2793.