Closed eugenca closed 8 months ago
Not sure what to do with tuple returning error
This might be better on #89, but a different (though not necessarily better) approach might be to open up Expression for extension. You mentioned that the goal was to optimize the compiled expression. If ToLambda was virtual, you'd have been able to override it without changing the public interface of Expression. You'd still probably want your ToLambdaExpression, but it could be protected rather than public.
something like:
public class OptimizedExpression : Expression {
public override Func<TResult> ToLambda<TResult>() => Optimize<TResult>(ToLambdaExpression<TResult>());
//Optimize() {}
}
If this is important to not change public interface, I could make it this way
I like @david-brink-talogy idea, let's go with the protected method. That'll make the API less confusing for people who are not looking for this feature.
Done, please review
Resolved all changes
see https://github.com/sklose/NCalc2/issues/89