[IronPython] FW: Writing a Compiler framework: Static typing use of the DLR

Tomas Matousek Tomas.Matousek at microsoft.com
Wed Jan 5 17:55:15 CET 2011


Forwarding to dlr at microsoft.com.

I'm not sure I understand what you want to achieve. Could you describe functionality your framework provides? 

Every language that integrates with DLR might use a different way of expressing late bound calls. C#'s dynamic type is one way of doing that. The code that actually performs the dynamic dispatch via DLR call sites usually looks like:

// Lazy-initialize a dynamic call-site object; provide a language specific binder that performs the runtime binding
if (site == null) { site = CallSite<Func<CallSite, T1, .. Tn, TResult>>>.Create(runtime_binder); }

// call the Target delegate of the site.
result = Site.Target(Site, args);

The runtime_binder for the site carries information about the dynamic operation available at compile-time. This includes e.g. a method name, the current accessibility context, etc.

Tomas

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Alexander Morou
Sent: Wednesday, January 05, 2011 6:39 AM
To: Iron Python Mailing List
Subject: [IronPython] Writing a Compiler framework: Static typing use of the DLR

Hello,

I'm not really sure where to ask this question, so I figured I'd ask on the mailing list of the project that largely started the DLR (assuming memory serves correctly.)  I'm writing a compiler framework, and I was wondering what kind of work, in AST rewrites I would need to perform, or classes from the DLR object model I would need to use, in order to support, what C# calls, a static type dynamic?  From what I can tell of C#, it uses its own model to wrap some of the concepts provided by the DLR, so I'm not exactly sure how to handle the late-bound dispatch so that it's marshaled by the appropriate language binder for a given object instance.  I could go deeper into how C# does it, but I don't really like the idea of looking at the code that was written by someone else (since the only way I can look at it is through a disassembler), my own code rewritten by C#'s compiler is fine, but the innards of what that code uses: no.

I understand the basic concept behind the DLR, but it's too complex to go over with a fine tooth comb.  Search algorithms aren't sophisticated enough to ask questions like this through google or bing (especially on, largely intangible, intent in code), which is why I ask here.  I originally asked Jeff Hardy
(http://jdhardy.blogspot.com/) for insight, and he suggested I look here.

Any insight anyone here can provide into this is appreciated.

Thanks,

-Allen [Alexander Morou] Copeland Jr.
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




More information about the Ironpython-users mailing list