Thursday, May 10, 2007

Dynamic language interop plans in .Net world too

I've recently explored the topic of in-process cross-language interoperability (think Python program using Ruby created objects etc.) in my "Adapters or Navigators" article.

Interestingly, I stumbled across posts in Jim Hugunin's (Jython and IronPython founder) blog recently about the exact same topic in the context of .Net - they seem to already have some implementation ready as part of their Silverlight initiative. Here are the posts:

A Dynamic Language Runtime

The new Dynamic Language Runtime (DLR) adds a small set of key features to the CLR to make it dramatically better. It adds to the platform a set of services designed explicitly for the needs of dynamic languages. These include a shared dynamic type system, standard hosting model and support to make it easy to generate fast dynamic code. With these additional features it becomes dramatically easier to build high-quality dynamic language implementations on .NET. More importantly, these features enable all of the dynamic languages which use the DLR to freely share code with other dynamic languages as well as with the existing powerful static languages on the platform such as VB.NET and C#.

Next two posts deal with a sort of "universal adapter", a common object model required for cross-language interop:

One True Object (Part 1)
One True Object (Part 2)

In the part 2, he illustrates how a dynamic language runtime queries an object "Do you have member X?", and the object thinks "I'm a Python object, so I'll look it up by Python rules". He envisions the IDynamicObject interface that all object implementations of all languages must implement for interoperability.

This is exactly what I claim to not necessarily be the best approach in my "Adapters or navigators" article, but that having pluggable metaobject protocols instead of an expected interface might be a more flexible solution.

It's nice to see though that other people also have this problem in their crosshairs :-)

No comments: