Interesting...

May 11, 2009 at 7:58 PM

I find the idea of a language such as D on .net intriguing, but I wonder: won't much of the unmanaged compiler goodness that comes with D be irrevocably lost when working with IL? After all, we still have huge performance differences between unsafe code with pointers and whatnot and compiled C++ code, so won't D just follow the same fate?

Coordinator
May 13, 2009 at 3:14 AM

It is not this project' s goal to replace the native compiler. If you think performance may be an issue, you always have the native compiler option.

However, I spent enough time in the industry to buy off the bat statements such as "language (or platform) A is inherently slower than B". Remember the old days when people thought is not even worth considering C++ because dispatching method calls through virtual tables was a performance killer? Well, some people may still swear by that today.

My take is that unless you prove your point with profiling data and benchmarks I do not believe you that D programs compiled for .net are significantly slower than native code.

Remember that in .NET what eventually runs on the hardware is native code, compiled from IL into machine code by the Just In Time engine. The executables are cached, so the JIT-ing costs tends to be amortized over time.

With no D compiler to generate IL code you can't profile and compare D on .NET versus D on the native OS.  Oh wait, now you can!

 

May 13, 2009 at 6:24 AM

I guess my question is this: why D on .NET? I mean, I know why we have C#, F# and Boo on .NET, so I'm curious as to what D can give me that others cannot.

Coordinator
May 13, 2009 at 6:56 AM

D has arguably more powerful support for generic programming than C# and C++ (for example, it supports variadic template arguments). It supports contract-programming as a language feature; it supports the concepts of const and immutable (missing from C#); associative arrays are a built-in feature that will save you the extra typing of using System.Dictionary. These are just a few things that come to mind. Keep an eye on Dr. Dobbs' s site, Andrei Alexandrescu is working on a piece called "The Case for D" which should be out soon (I reviewed a couple of the early drafts and it promises to be a great read).

Additionally, D on .NET is a very interesting exercise in compiler construction ;)