Roslyn API for .NET
Author |
Message |
mirhagk
|
Posted: Tue Jul 24, 2012 9:35 am Post subject: Roslyn API for .NET |
|
|
Not sure if anyone else here actually uses .NET but the roslyn API was released not too long ago, and it actually provides a very interesting take on scripting.
Basically you pass it a string and it uses a scripting engine to run the code, same as any scripting engine, but it has a nice twist. You can pass an object to the script, with all of the members of that object becoming available to the script source code. This is cool enough, but when you combine it with lambdas and actions/funcs it becomes down right powerful.
Rather than having a script run every so often, you can create a script that simply creates lambdas and assigns those lambdas to the actions/funcs. This is the equivalent of creating a new function in a script and passing the function pointer back to the host. It takes a little overhead to run the script the first time, but after that your simply calling an action/func (which with performance tests is really about the same speed as calling a regular function anyways, and it allows the JIT compiler to inline it if it so desires). It also allows to just script things regularly if the action is only going to be running once, and so the scripting overhead is less than the compiling overhead.
Roslyn creates the fastest scripting language out there, because it allows scripted code to run inline with the program, something that hasn't happened with other scripting languages.
Anyways, if you use .NET I'd suggest looking into roslyn for curiosity's sake, it's really cool. (it also supports both vb and C#, which is a nice added bonus, and it adds a scripting console to visual studio, which is also a nice bonus). |
|
|
|
|
|
Sponsor Sponsor
|
|
|
2goto1
|
Posted: Tue Jul 24, 2012 12:53 pm Post subject: RE:Roslyn API for .NET |
|
|
I think that you forgot about IronPython, which has existed for years. |
|
|
|
|
|
mirhagk
|
Posted: Tue Jul 24, 2012 1:53 pm Post subject: RE:Roslyn API for .NET |
|
|
Yeah I know of IronPython, and have used it a bit. Does it support passing lambdas back to the host application, and allowing the host to call those without doing any scripting? |
|
|
|
|
|
|
|