dlr

Access Expression methods in IronRuby

This code works fine in C#: Expression.Lambda(LambdaBody); But none of the methods for building AST seem to visible from IronRuby. I required Microsoft.Scripting.Core and Microsoft.Scripting libraries. Do I need something else? Here is the IronRuby code: require 'C:\reorganize\software\ironruby-1.0rc3\ironruby\bin\microsoft.scripting...

Is it possible to use DLR in a .NET 3.5 website project?

I'm trying to evaluate an expression stored in a database i.e. "if (Q1 ==2) {result = 3.1;} elseif (Q1 ==3){result=4.1;} else result = 5.9;" Rather than parsing it myself I'm trying to use the DLR. I'm using version .92 from the Codeplex repository and my solution is a .NET 3.5 website; and I'm having conflicts between the System.Core...

DynamicObject and WCF support

I was wondering if anyone has had any luck getting a DynamicObject to serialize and work with WCF? Here’s my little test: [DataContract] class MyDynamicObject : DynamicObject { [DataMember] private Dictionary<string, object> _attributes = new Dictionary<string, object>(); public override bool TryGetMember(GetMemberB...

IronPython memory leak?

Run this: for i in range(1000000000): a = [] It looks like the list objects being created never get marked for garbage collection. From a memory profiler, it looks like the interpreter's stack frame is holding onto all the list objects, so GC can never do anything about it. Is this by design? EDIT: Here is a better example of t...

Creating WCF Services using Dynamic Languages and DLR

I was curious how anyone would go about creating WCF based services using a dynamic language like IronPython or IronRuby. These languages do not have the concept of interfaces. How would someone define service contracts? Would we need to rely on static languages for such kind of tasks? I am a big fan of Python in particular and would lik...

.NET 4.0 Dynamic object used statically?

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 ...

C# 4.0: casting dynamic to static

This is an offshoot question that's related to another I asked here. I'm splitting it off because it's really a sub-question: I'm having difficulties casting an object of type dynamic to another (known) static type. I have an ironPython script that is doing this: import clr clr.AddReference("System") from System import * def GetBclUr...

What is the most simple implementation of IDynamicMetaObjectProvider?

Hi, I have this scenario... 1.- I'm providing a "Dynamic Table" for wich users can define Fields. Each Dynamic Table will have as many rows/records as needed, but the Field definitions are centralized. 2.- My Dynamic Row/Record class was inherited from the .NET DLR DynamicObject class, and the underlying storage was a List appropriatel...

Eval IronPython Scripts during ASP.NET Web Request; Static Engine or Not

I would like to create an ASP.NET MVC web application which has extensible logic that does not require a re-build. I was thinking of creating a filter which had an instance of the IronPython engine. What I would like to know is: how much overhead is there in creating a new engine during each web request, and would it be a better idea to ...

Most common applications of the C# 4.0 dynamic type

Now that people have been using C# 4.0 for a while I thought I'd see how people were most often using the type 'dynamic' and why has this helped them solve their problem better than they may have done previously? ...

C# monkey patching - is it possible?

Is it possible to write a C# assembly which when loaded will inject a method into a class from another assembly? If yes, will the injected method be available from languages using DLR, like IronPython? namespace IronPython.Runtime { public class Bytes : IList<byte>, ICodeFormattable, IExpressionSerializable { internal by...

What is a good practical application example of the Dynamic Language Runtime in .NET 4.0?

I wish to better understand the real-world application of this new feature that consists the Dynamic Language Runtime (DLR). I would like: Brief explanation of how it could be used; A brief sample code that shows how to take advantage of it. Thanks! =) ...

Simpler Linq to XML queries with the DLR

Hi folks, I have a question regarding Linq to XML queries and how we could possibly make them more readable using the new dynamic keyword. At the moment I am writing things like: var result = from p in xdoc.Elements("product") where p.Attribute("type").Value == "Services" select new { ... } What I would lik...

How can I use –X:Frames in C# 2.0 to load ironpython?

I can use ironpython 2.6 (not for .net 4) load numpy, running ipy with -X:Frames or -X:FullFrames on the command line. But, if I want to use Ironpython/DLR in C# 2.0 to load the py file, how can I use -X:Frames or -X:FullFrames? I tried it like this: var lang = Python.CreateLanguageSetup(null); lang.Options["Frames"] ...

Assign string held in an object variable to a string property of a dynamic (C#)

B"H I know its a bit of a mouthful and may not be totally understandable. So here is an example of what I am trying to do. public class TypeWithString { public string MyString { get; set; } } string s = "We Want Moshiach Now"; TypeWithString tws = new TypeWithString(); object o = s; dynamic d = tws; d.MyString = o; This code sur...

Can someone please explaind me what is DLR and how it used in sms gateways?

Can someone please explaind me what is DLR and how it used in sms gateways? ...

How can I set up dynamic imports when hosting IronPython?

I'm writing a C# client application which is intended to have strong support for customisation via scripting, and I have chosen IronPython as my target scripting language. I would like to keep the user's code in the application's database with the rest of its state, but I need the user to be able to split their scripts into files and mod...

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

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 ca...

A few questions about the DLR

Is it true that all operations on the dynamic type are dispatched to the DLR? From this video, it looks like but they don't say it in so many words and I just want to be sure that the statement is right as I was about to write it in some communication. They also say that the DLR is currently in System.Core.dll. I want to know if the DL...

How do I embed iron ruby into a c# program?

I want to embed iron ruby into a mud that I am creating and for some reason I'm having trouble finding the correct examples to get started. All I want to do is create a game where 'you' the player will program bots in iron ruby and then I will interperet the code in c# and make the bots do what you want them to. Also, I want to make it...