The title is pretty self explanatory on this one.
To clarify: I've built a pretty complete language infrastructure using dynamic expressions and thought it would be cool to try outputting an assembly. Anybody with experience doing this knows "LambdaExpression.CompileToMethod" requires converting the dynamic expressions to a CallSite<> and assigning it to a private field somewhere that your expressions can access later.
I have been successful in doing this in some test projects, but before I go and refactor all (and I mean all) my code (again) I need to know if I have to do the same for binder instances created during the Fallback process.
protected override void FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) {
// If I make a DynamicExpression here, does it need to be a CallSite<> ?
// Or since it's inside the context of an executing delegate (CallSite<>),
// is it considered "Live" ?
}
Also, using "Expression.Constant" has it's limitations when compiling to a method. Does that limitation also exist inside the binders or is that considered "runtime" and "safe".
Well, after some tests. Yes it is safe. DynamicExpressions created during a fallback does not have to be converted to a CallSite<>. However, it should be noted that ALL DynamicExpressions in the original expression do.