-
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
API Design Review: Conditionals #683
Comments
http://msdn.microsoft.com/en-us/library/dd233182.aspx I don't know of anyone using this for real in Rx.NET. |
These could be moved into a |
These can be used for CEP scenarios to reason over multiple streams. It is best that they stay in some form or other as Java does not have anonymous classes like C# where they could be easily avoided by joining fields into a anonymous class. They are more needed in the JVM implementation than in .net. Ideally the senarios should be expanded in RxJava. |
@sirinath can you give a concrete example? I don't see the connection between these operators which are intended to overload imperative control structures in F# computation expressions and anonymous types. |
If this is extended to accept an observable sequence as the condition / selector then it would be more useful. Say I want to buy using signal A if vol is greater than a certain threshold plus some other computationally expensive conditions and signal B otherwise only if I am trading that instrument for the day and I only trade 0.5% of instruments. The current form is somewhat useful if we want to certain set of signals at start of the day but this is something you can do otherwise eagerly at a cost. Also it would be useful if the conditional is also an observable sequence as you can select between streams than at subscription. Using Linq you can aggregate multiple items into anonymous class and select what is needed at the end from this in a further query. This is more difficult though possible in Java than C# hence it will be good to have the conditional functionality extended for other use cases. More powerful it would be if you have linq Expressions. This is also possible through Commons JCI or directly using Janino. Perhaps at a later stage. |
Also the conditions or index can be extended to a function to take 1 item from each stream and return the appropriate values (boolean / index) for item selection. If not subscribers the condition is not evaluated and if possible each item can be discarded from the streams. This would be a more convinient way to use this functionality. |
@sirinath Could you provide a concrete example? I am not sure that I understand what you are after precisely. |
The conditional operators are going in this contrib module. See ReactiveX#683
Migrating conditionals to a contrib module: #714 |
Here is a link to documentation on their usage: http://weblogs.asp.net/podwysocki/archive/2010/06/18/introduction-to-the-reactive-extensions-for-javascript-conditionals.aspx |
Add an extra overload with Func<bool, TResult, TResult> condition for if and Func<TValue, TResult[]> selector ... etc. if( this case condition is evaluated as needed but for each element coming in |
In a nutshell the extension will help combination and generation. Something you can consider for the main implementation also. |
The conditional operators are going in this contrib module. See ReactiveX/RxJava#683
Discussion with @headinthebox suggests that the conditional operators really don't belong in RxJava (at least not the core) as they were added to Rx.Net for very specific use cases in F#.
These include
ifThen
,switchCase
,doWhile
,whileDo
.Are there reasons to keep these? If so do we move them out of
Observable
or should we delete them?/cc @headinthebox and @jhusain
The text was updated successfully, but these errors were encountered: