zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
449 stars 86 forks source link

Performance Idea #26

Closed TonyValenti closed 6 years ago

TonyValenti commented 6 years ago

Hi ZZZ, This isn't a bug report but an idea that I had that I wanted to share with you. Ya'll seem to know the insides of .NET pretty well.

Anyway, I would definitely pay for the ability to convert runtime code into static values. For example, let's say I have this code:

Console.WriteLine(MultAdd(1,3));

[Fold] 
public static void MultAdd(int x, int y){ 
    return x*y+4; 
}

I would like my code to compile, and then, everywhere a [Fold] method is invoked, if all the values are knowable, then actually invoke the function and replace the value. Essentially, the code above would be rewritten into:

Console.WriteLine(7);
JonathanMagnan commented 6 years ago

Hello @TonyValenti ,

Could you provide us an example of use? Even if the example doesn't work, that will give us some hint about how you will want to use it since I'm not 100% certain to fully understand the request yet.

Best Regards,

Jonathan

JonathanMagnan commented 6 years ago

Hello @TonyValenti ,

This issue will be closed since we haven't heard back from you.

Feel free to reopen it if you can provide the information we asked.

Best Regards,

Jonathan