Let's say I wanted to create a dynamic language compiler/interpreter, a Scheme interpreter perhaps, on the .NET platform as it exists today. Would I be better off using the Dynamic Language Runtime (DLR), or using C# 4.0 to implement my language's dynamic features? Or do I need both?

I know that there has been other work done in this area, in particular with IronScheme and IronPython. Both of those languages use the DLR; I believe IronPython uses the most current version of the DLR (which is about a year old), while IronScheme uses an early, heavily modified fork of an early version of the DLR. But C# 4.0 was not available when these compilers were created.

I've seen Rob Conery's work with Massive, using C# 4.0's dynamic features; it is quite impressive. But would C# hold up to the full-scale effort of a dynamic language compiler/intepreter? Are there features in the DLR that are missing from C#, or was the DLR essentially rolled into C# 4.0? Would I be missing any important features of the DLR if I just used C# 4.0 exclusively?

  • I believe the .Net 4.0 Dynamic features are based on the DLR also.
    – Dave Nay
    Commented Aug 11, 2011 at 17:21
  • 1
  • @Dave: I would be satisfied with a current, authoritative link to an article describing in detail the relationship between the .NET 4.0 runtime and the DLR. This would give me a fair idea if the dynamic type system in C# 4.0 is robust enough, and whether there are any critical features in the DLR that were omitted from the .NET 4.0 runtime. I've found some articles, but they were all written back in the day when the DLR was taking shape, and many of them are speculative. Commented Aug 11, 2011 at 17:47

2 Answers 2


This is the article I remember reading. msdn.microsoft.com/en-us/magazine/gg598922.aspx

Later the DLR was also included in the .NET Framework 4 to support dynamic features in C# and Visual Basic. If you only need the dynamic keyword in C# 4, you can simply use the .NET Framework and in most cases it will handle all interactions with the DLR on its own. But if you want to implement or port a new dynamic language to .NET, you may benefit from the extra helper classes in the open source project, which has more features and services for language implementers.


From: jimmysch


The facts: IronRuby and IronPython both use the DLR, in fact most of the DLR's features are derived from earlier implementation of IronPython. I'm not familiar with how what version of the DLR IronScheme uses. A portion of the DLR (Microsoft.Scripting.Core.dll) was shipped in .NET 4.0 in System.Core.dll, and that portion is what C# 4.0 uses for it's "dynamic" keyword support, which is why that assembly is not present in .NET 4.0 builds of the DLR.

The rest of the DLR's codebase (Microsoft.Scripting.dll, Microsoft.Dynamic.dll are the most important) are available for download from this CodePlex project, or the IronLanguages GitHub project. They provide the APIs for consumers and producers of hosting languages, while the APIs in .NET 4.0 are for actually doing dynamic dispatch of methods.

To write a dynamic language compiler for .NET 4.0, I'd use C# as the implementation language and use the DLR as a library for simplifying common compiler tasks. For a simple example language on the DLR, look at Sympl.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.