dynamic-language-runtime

IronPython import performance with compiled code

ぐ巨炮叔叔 提交于 2019-12-10 11:35:45
问题 I am doing some experiments with IronPython 2.6.1 and the clr.CompileModules function to compile my large scripts into assemblies. Testing has shown good cold start performance performance improvements but in some cases importing the compiled module is actually slower than executing a large string that represents my code in some cases. My question is, if i use something like scope.Engine.Execute(string.Format("from {0} import {0}", theModule), scope); or the ImportModule function, even though

Would you recommend Iron Ruby, Iron Python, or PowerShell for making a C# application a script host?

夙愿已清 提交于 2019-12-09 15:01:36
问题 Would you recommend Iron Ruby, Iron Python, or PowerShell for making a C# application a script host? After some quick tinkering, right now I'm leaning towards powershell for two main reasons (note these a purely my opinions and if they are wrong, I'd love to know!!!): 1) It's simple to create a runspace with classes in your application; therefor it's easy to make your application scriptable. 2) I've heard some rumors that IronRuby and IronPython are losing support from Microsoft, so they may

Resources to learn how to create a compiler /interpreter for the .NET framework

蓝咒 提交于 2019-12-09 13:42:10
问题 I'd like to learn more how to create a language for .NET framework. I think I'd like to build a DLR language. I'm having hard time founding good resources. I found a descent article on MSDN that was written more than a year ago. I also spent couple of hours looking at IronPython source code. Could you please share with your resources on this subject. Thanks 回答1: Have a look at the links compiled on this blog. http://benjaminnitschke.com/post/2009/03/31/Writing-your-own-programming-language

Is it possible to load and execute C# snippets using DLR?

淺唱寂寞╮ 提交于 2019-12-09 06:07:44
问题 The majority of material I have found regarding DLR is related to IronPython. Can you parse and execute C# using DLR? If so is there over head that would prevent you from attempting this on a web server with about 30 users? More specifically I would like to script the configuration of my workflow objects when a user first initiates a workflow. Depending on conditions that change through out the year workflows may start at different steps, hence running configuration scripts seems like a good

Is it possible to host the .Net DLR in an “idiot-proof” sandbox?

给你一囗甜甜゛ 提交于 2019-12-09 05:42:16
问题 I would like to host the Dynamic Language Runtime (DLR) in such a way that users who run arbitrary scripts in it cannot bring the process down? The DLR hosting spec describes how to host the DLR in a separate ApplicationDomain. This allows to tear down and unload a script runtime and to restrict certain operations through CAS (e.g. I can restrict file system access or disallow use of reflection). But are there also ways to for example: - restrict the maximum amount of memory used by a script?

.NET 4.0 Dynamic object used statically?

半城伤御伤魂 提交于 2019-12-08 06:35:55
问题 I've asked another related question to this here: casting dynamic to static problem I've gotten quite sick of XML configuration files in .NET and want to replace them with a format that is more sane. Therefore, I'm writing a config file parser for C# applications that will take a custom config file format, parse it, and create a Python source string that I can then execute in C# and use as a static object (yes that's right--I want a static (not the static type dyanamic) object in the end).

Performance of Mass-Evaluating Expressions in IronPython

这一生的挚爱 提交于 2019-12-07 11:14:28
问题 In an C#-4.0 application, I have a Dictionary of strongly typed ILists having the same length - a dynamically strongly typed column based table. I want the user to provide one or more (python-)expressions based on the available columns that will be aggregated over all rows. In a static context it would be: IDictionary<string, IList> table; // ... IList<int> a = table["a"] as IList<int>; IList<int> b = table["b"] as IList<int>; double sum = 0; for (int i = 0; i < n; i++) sum += (double)a[i] /

IronPython - JSON choices

江枫思渺然 提交于 2019-12-07 10:55:11
问题 What is the best way to deal with JSON in IronPython 2.0.1. The native Python "standard library" json looks to be not implemented yet. If I wanted to use the Newtonsoft Json.NET library how do I do this? I could add the assembly to the GAC, but what are my other choices? 回答1: This link provides an overview of the ways to add refernces to .Net dlls with IronPython: Haibo Luo's weblog : IronPython: clr.AddReference So, for example, if you'd likle to avoid placing the Json.NET library in the GAC

DLR and Javascript interpretation in c# 4?

橙三吉。 提交于 2019-12-07 07:43:10
问题 I want to execute a javascript code from c# using DLR. So I wrote a simple code using c# and Jint : var script = @" function show( ) { return parseInt('123asd'); //in js it's 123 }; return show();"; var result = new JintEngine().Run(script); Console.WriteLine(result); parseInt('123asd') in javascript is : 123 But the result I get is : Maybe I don't see the whole picture, but if a programmer on the other side of the world sends me his script file, I (and him) expect the result to be consistent

How to Implement the Ternary Operator in the DLR

五迷三道 提交于 2019-12-07 04:16:46
问题 I am implementing a language interpreter in C# using the DLR, and I'm having some troubles with the ternary operator. At this point, I have basic function declarations/calls implemented, like so: F := (x) -> x + 1 F(1) # returns 2 I've not had a problem with a function body being a sequence of expressions -- the value of the last expression is always returned, and I've made sure all cases in the interpreter return at least something as a side effect. I'm now trying to implement the ternary