Conversation
|
Changes in math operations seems safe, however in comparisons the behavior may be not fully backward compatible, in particular: Current impl: Proposed: Comparer implementation may be custom, and this may (potentially) change existing expressions evaluation. |
|
There would be problems with operators like >, <,... because operator == usually returns bool, which is insufficient for decision about greater value. It would be possible to modify operations this way (when comparer is returning null if there is no known way to compare): But there is still operators ==, !=. They don't know which way the comparer handles null values. I could pull NullComparison property up to IValueComparer but that would be a breaking change too. Or I could try to cast current comparer to NReco.Linq.ValueComparer and handle it according to selected mode. But what would be the result of comparison when the cast failes? Maybe there is another way. I just can't see it now. I would understand if you refuse this PR. |
I don't see any problems here, as currently all comparisons inside LambdaParameterWrapper are based on
I cannot merge current PR's changeset as it may break backward compatibility - this is unacceptable for the expressions parser because often expressions are entered by the end-user (and this incompatibility may appear as a wrong evaluation result). I'll try to adopt your approach (when I'll have a bit of free time for that) to make possible to use System.Numerics.Complex (or another custom types) and guarantee backward compatibility. |
Proposition of support of types which are not IConvertible. For example System.Numerics.Complex or some custom struct with overloaded operators.