[Mono-list] CSharp interpreter feedback, and a gift
Doug Blank
doug.blank at gmail.com
Fri Jan 28 11:14:43 EST 2011
On Fri, Jan 28, 2011 at 9:41 AM, Miguel de Icaza <miguel at novell.com> wrote:
>> My bad; that works. This doesn't: evaluator.Evaluate("using System;\n
>> int b;") nor evaluator.Run("using System;\n int b;") I'm assuming
>> because the "using System;" is not an expression?
>
> Correct, you can not mix using statements and regular code, that is
> the only limitation.
Ok, I've worked around that by going through the code line by line,
pre-Run() any "using X;" statements, then Evaluate() the rest. That
functionality could be built-in.
If there are compiler commands to allow functions and classes, I'd
love to do that. That is the biggest limitation.
I couldn't get IronPython to correctly tell Evaluate/Run to re-direct
the Out/Error messages, even though the executed code does redirect.
Evaluate must be doing something funny under the hood to cache the
streams.
Two other wish-list items:
1) it would be handy to inject a variable into the environment of the
Evalutor. Something like: Evaluator.SetValue("x", my_value). Of
course, one can do that from inside the interpreter, but I have values
outside that I would like to inject in. There is probably a way
through reflection to get to the value, but that would be a handy
function.
2) relatedly, it would be nice to have some way of sharing
environments between DLR languages and interpreted Csharp.
In any event, one can now control robots interactively with
interpreted CSharp. Thanks!
-Doug
More information about the Mono-list
mailing list