You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to revive and old from codeplex https://roslyn.codeplex.com/discussions/571077 and provide an implementation that does not required modifiaction from BCL but will be really handy for at least some scenarios (not all!).
I have implemented such an approach in my scripting engine basing on Roslyn (as frontend) and LINQ Expressions as a backend.
It utilizes existing mechanism declaring inline lambda and invoking it. It preserves single-evaluation semantics, without requiring special support from BCL.
I am fully aware inline lambdas are actually blackboxes for many LINQ providers, but such a blackbox is still better than not supporting such a useful operator at all!
The text was updated successfully, but these errors were encountered:
The more general request of extending expression trees with features that are allowed in normal expressions is #2060. I think that it makes more sense to consider that proposal as a whole, instead of adding the features one by one.
@svick
I aggree. I was unable to find previous issue because I was searching for "null-propagating" as in original issue instead of "null-coalescing" ;). Thanks for pointing out proper issue.
I would like to revive and old from codeplex https://roslyn.codeplex.com/discussions/571077 and provide an implementation that does not required modifiaction from BCL but will be really handy for at least some scenarios (not all!).
I have implemented such an approach in my scripting engine basing on Roslyn (as frontend) and LINQ Expressions as a backend.
Expression.Invoke(Expression.Lambda(Expression.Condition(Expression.Equal(parm, Expression.Constant(null)), Expression.Default(rtype), translatedWhenNotNull), parm), translatedExpression);
It utilizes existing mechanism declaring inline lambda and invoking it. It preserves single-evaluation semantics, without requiring special support from BCL.
I am fully aware inline lambdas are actually blackboxes for many LINQ providers, but such a blackbox is still better than not supporting such a useful operator at all!
The text was updated successfully, but these errors were encountered: