[Mono-bugs] [Bug 675755] New: Enable explicitly typed expression evaluation in the C# Evaluator

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Feb 28 17:40:58 EST 2011



           Summary: Enable explicitly typed expression evaluation in the
                    C# Evaluator
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.8.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: P5 - None
         Component: C#
        AssignedTo: msafar at novell.com
        ReportedBy: kramieb at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.21
(KHTML, like Gecko) Ubuntu/10.04 Chromium/11.0.677.0 Chrome/11.0.677.0

Allow generic type parameters for the `Evaluator.Compile()` and
`Evaluator.Evaluate()` methods to allow more flexible input expressions, e.g.

Consider the following use case:

    var code = "x => x * x" // can be from any input;
    var lambda = Evaluator.Evaluate<Func<float, float>>(lambda);

Currently this has to be done using:

    var lambda = (Func<float, float>)Evaluator.Evaluate("Func<float, float> f =
" + lambda + "; f;");

This is unwanted for at least two reasons:
 - Extra variable introduced, this could infer with the input.
 - The expression (here `code`) must be rhs valid;

This feature would consist of the addition of the following four methods and
one delegate:

    public static T Evaluate<T>(string input);
    public static string Evaluate<T>(string input, out T result, bool
    public static CompiledMethod<T> Compile<T>(string input);
    public static string Compile<T>(string input, out CompiledMethod<T>
    public sealed delegate void CompiledMethod<T>(ref T retvalue);

Reproducible: Always

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list