-
Notifications
You must be signed in to change notification settings - Fork 747
-
Notifications
You must be signed in to change notification settings - Fork 747
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
Could we have Tuple Overload for Zip, CombineLatest, and any other combine type method? #1269
Comments
Since there is a |
Agreed. The symmetry is worth having and extending to
Example: public static IObservable<(TFirst First, TSecond Second)> Zip<TFirst, TSecond> (this IObservable<TFirst> first, IObservable<TSecond> second); We have to match the casing ( Also, right now, these methods also use One caveat I can see at this point is that we'll need some
Maybe, once .NET 5 ships, we can tighten the target platforms matrix a little bit? (E.g. I'd be happy to boost .NET Framework minimum requirements for Rx vNext to v4.7.2 where a lot of issues were addressed IIRC.) |
Preliminary work to make adding overloads easier is done in #1302. |
There's an unfortunate breaking change that needs to be pondered before we go ahead: public static IObservable<IList<TSource>> Zip<TSource>(params IObservable<TSource>[] sources) If an overload is added for tuples, such as: public static IObservable<(TFirst First, TSecond Second)> Zip<TFirst, TSecond>(this IObservable<TFirst> first, IObservable<TSecond> second) then code like this (where Observable.Zip(xs, ys) encounters a change in return type (from The same issue occurs for |
Now is a good time for a breaking change. I bumped the ver to 5.x in #1291 since I had to also rename If we need to do more breaking changes, I think it's a good time to do it. |
We can't really take away the params-based overload; there is no good alternative for it. Anyone using this overload (that's been there since day 1) will have been writing Observable.Zip(xs, ys), for any number of sources, and always get an IObservable of lists. When adding these new variants, the old behavior would show up when specifying more than 16 sources (or whatever number of overloads we support), but not when specifying less than 16. The only alternative I see right now is to put the new overloads in ObservableEx (or whatever name). They're still discoverable as extension methods. But Observable.Zip won't bind to the new overloads, this preserving compat. Nothing is more frustrating than upgrading a dependency and seeing your code (possibly more than 8 years old in this case) break in a random place. It's twice as bad if there's no alternative to restore the old behavior. So let's proceed with caution and put them on a different type. Still extension methods, so most people won't notice. Only when calling them as static methods does the ObservableEx (or whatever) type show up. |
I'll prepare a PR later this weekend, time permitting. |
This is checked in now. |
Feature request
It would be more comfortable to work with
Zip
andCombineLatest
to let it generateTuple
by default when we don't supply result functionIs it possible?
The text was updated successfully, but these errors were encountered: