Tailcall parameter in Expression.Lambda
What is the reason behind giving a parameter for tailcall optimization in
Expression.Lambda(Expression body,bool tailcall,
IEnumerable<ParameterExpression> Parameters)
As long 开发者_StackOverflowas it is not going affect the result why do we explicitly need to specify a value for it.And i feel it is always better to have tailcall optimization. Do you have different thought on this
The design is kinda funny.
Passing true
for the tailcall
parameter, will attempt to call method in a tail position as a tail call within the body of the lambda.
A tail position is where a method call is the expression being returned.
As for better, that is subjective.
- Tail calls tend to be always slower
- There are certain rules to follow (return types must match or be references)
- You have no stacktrace for debugging
精彩评论