Is the DLR needed in .NET 4.0?
Asked Answered
D

4

7

I'v been looking into using DLR for my toy language, and I'm a bit confused. If .NET 4.0 has LINQ Expression trees, Dynamic Objects and the "dynamic" type, then do we really need the DLR anymore? What does the DLR provide that would make my life easier as a language developer

--- Edit ----

Let me explain my question a bit better. The DLR project found on codeplex (dlr.codeplex.com), is there much of a need for that anymore? Are all the features of this DLR project rolled into .NET 4? Or is there something of value left to be found in DLR?

Dagger answered 18/7, 2011 at 23:45 Comment(1)
The "dynamic" type uses the DLR under the hood.Tall
D
2

It doesn't quite answer your question but I was very interested to read Jim Hugunin's message about leaving Microsoft a while ago.

One of the things that he pointed out was that the DLR was the driver behind many of the nice advances we have in .Net 4.0 that you now say are the reason why you might not need the DLR anymore.

Edit: Link to the messsage - http://hugunin.net/microsoft_farewell.html

On the other hand, I think that the DynamicSite system is still something that's quite valuable to have, whilst not necessarily something important to put in the CLR itself.

2nd edit: this is an interesting query really, I've just been looking at the docs on Codeplex. As you state and clarified, the .net 4.0 CLR does implement the kind of things that used to make the DLR special; Reading the DLR overview, I think that basically the idea is that things that are implemented with the DLR have the advantage of getting access to new features more quickly then waiting for a new version of the Framework.

This might be moot as they've not released a new version of the DLR for a while now!

Another possible advantage, but I admit I've not explored this properly, is that the AST in the DLR has more features:

Shared AST (Expression Trees) -- This is one of the core pillars of the DLR. We have extended LINQ Expression Trees to include control flow, assignment, etc. We also ship the sources for all of Expression Trees v1 and v2 (the new stuff for the DLR). Expression Tres are part of lowering the bar for porting languages to .NET, and we use them in the binders and DynamicMetaObject protocols.

Denham answered 19/7, 2011 at 0:42 Comment(0)
E
4

During the development of the DLR we split it into two parts - the inner layer and the outer layer. The inner layer consisted of call site caching, the extended expression trees, and the meta object protocol. All of that was intended to and was added to .NET 4.0.

The outer layer consisted of the hosting APIs, expression tree interpreter, COM interop support, a customizable overload resolver for calling .NET methods, a default binder for most of the DLR operations, and many other various helpers. None of this has shipped w/ the .NET framework but could still be useful to you. When using this on .NET 4.0 it relies upon the DLR APIs shipped w/ .NET 4.0.

The outer layer was also split into two parts - the hosting APIs (Microsoft.Scripting.dll) and everything else (Microsoft.Dynamic.dll). You can target the DLR hosting APIs if you want people to be able to host your language in the same way they host IronPython and IronRuby. And you could either use Microsoft.Dynamic.dll or just pull useful pieces of code from it rather than re-inventing the wheel. In either case if you want the latest version you'll need to check out the IronPython/IronRuby web sites as Microsoft is no longer actively developing the outer layer components.

Ellamaeellan answered 21/7, 2011 at 2:35 Comment(0)
D
2

It doesn't quite answer your question but I was very interested to read Jim Hugunin's message about leaving Microsoft a while ago.

One of the things that he pointed out was that the DLR was the driver behind many of the nice advances we have in .Net 4.0 that you now say are the reason why you might not need the DLR anymore.

Edit: Link to the messsage - http://hugunin.net/microsoft_farewell.html

On the other hand, I think that the DynamicSite system is still something that's quite valuable to have, whilst not necessarily something important to put in the CLR itself.

2nd edit: this is an interesting query really, I've just been looking at the docs on Codeplex. As you state and clarified, the .net 4.0 CLR does implement the kind of things that used to make the DLR special; Reading the DLR overview, I think that basically the idea is that things that are implemented with the DLR have the advantage of getting access to new features more quickly then waiting for a new version of the Framework.

This might be moot as they've not released a new version of the DLR for a while now!

Another possible advantage, but I admit I've not explored this properly, is that the AST in the DLR has more features:

Shared AST (Expression Trees) -- This is one of the core pillars of the DLR. We have extended LINQ Expression Trees to include control flow, assignment, etc. We also ship the sources for all of Expression Trees v1 and v2 (the new stuff for the DLR). Expression Tres are part of lowering the bar for porting languages to .NET, and we use them in the binders and DynamicMetaObject protocols.

Denham answered 19/7, 2011 at 0:42 Comment(0)
B
1

As this wiki page (http://en.wikipedia.org/wiki/Dynamic_Language_Runtime) explains, the DLR is used with IronPython and IronRuby, so yes, it is still needed.

It will make your life easier if you can use a more dynamic language for your development.

Barium answered 19/7, 2011 at 0:41 Comment(0)
A
1

The DLR on codeplex is open source, so it's MUCH easier to make improvements/additions to support features your language may need.

Aricaarick answered 19/7, 2011 at 0:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.