If you add a variable to the interpreter that is a dynamic/ExpandoObject with a string member, then attempt to use that string member in a function, you get an exception:
DynamicExpresso.Exceptions.ParseException : Argument list incompatible with delegate expression (at index 0).
Here is a test that demonstrates the behavior.
var evaluator = new Interpreter();
// create path helper functions in expressions...
Func<string, string, string> pathCombine = (x, y) => System.IO.Path.Combine(x, y);
evaluator.SetFunction("PathCombine", pathCombine);
// add a GlobalSettings dynamic object...
dynamic globalSettings = new ExpandoObject();
globalSettings.MyTestPath = "C:\\delme\\";
evaluator.SetVariable("GlobalSettings", globalSettings);
// Here is a workaround that succeeds - you have to cast GlobalSettings.MyTestPath to string:
string works = (string)evaluator.Eval("PathCombine((string)GlobalSettings.MyTestPath,\"test.txt\")");
Assert.That(works, Is.EqualTo("C:\\delme\\test.txt"));
// I think this should work, but doesn't:
string doesntWork = (string)evaluator.Eval("PathCombine(GlobalSettings.MyTestPath,\"test.txt\")");
Assert.That(doesntWork, Is.EqualTo("C:\\delme\\test.txt"));
Because PathCombine takes a string, and GlobalSettings.MyTestPath is a string, I think this should work?
If you add a variable to the interpreter that is a dynamic/ExpandoObject with a string member, then attempt to use that string member in a function, you get an exception:
DynamicExpresso.Exceptions.ParseException : Argument list incompatible with delegate expression (at index 0).Here is a test that demonstrates the behavior.
Because PathCombine takes a string, and GlobalSettings.MyTestPath is a string, I think this should work?