[Mono-list] CSharp interpreter feedback, and a gift

Doug Blank doug.blank at gmail.com
Fri Jan 28 07:03:00 EST 2011


Thanks for the feedback. Some comments below. Note that I'm doing this
from IronPython, so this is a slightly different context that the
typical. The code for this 76-line wrapper is here:

http://svn.cs.brynmawr.edu/viewvc/Pyjama/trunk/languages/CSharpLanguage.py?view=markup

On Fri, Jan 28, 2011 at 1:40 AM, Miguel de Icaza <miguel at novell.com> wrote:
>> 1) a single evaluate function which could handle expressions and statements.
>
> This is already the case.

I should be more precise: If you use Evaluate(), and don't get back a
result, you have to catch the exception. If you use Run(), you can't
get back anything. It would be nice if there was one function, and if
there were an exception, it was from the underlying code, not that the
Evaluate didn't return something.

>> 2) able to evaluate multiple statements, without evaluating them one by one.
>
> That is also the case.

Ok, then I must be missing something. It looks like in the csharp.exe
code that it is handing Evaluate one expression at a time. This does
not work for me from IronPython.

evaluator.Evaluate("int a;\n int b;")

>> 3) handle errors through a return or raised exception, rather than
>> through a side-effect print to Console.Out, or Console.Error
>
> I have to look into this one in particular, are these compilation
> errors, or the execution errors?

Both are currently sent to Out or Error. I would like it better if
they were thrown or returned.

> You can control where the error messages go by assigning a TextWriter
> object to the InteractiveBase class's Output and Error properties.

Yes, but this can get complicated in IronPython, and for some reason
this isn't currently working in Pyjama. If I could handle these
messages myself, that would give me more control. It may be that I
need to load things in a different order.

>> I haven't looked into how the Csharp interpreter actually works, but
>> it would be excellent if the user could define functions and classes,
>> in the environment. Would that be possible?
>
> It is not currently possible.   This requires some work on the
> compiler to enable the feature.

Pointers much appreciated!

-Doug

> Miguel.
>


More information about the Mono-list mailing list