BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Source for the D.NET Compiler is Now Available

by Jonathan Allen on May 15, 2009 |

D is a relatively new language that, like ObjectiveC, tries to address some of the more serious problems in C++. From our interview with Cristian Vlasceanu,

In many ways D encourages the "right" behavior. For example, in C and C++, if you write "int i;" the variable is uninitialized. To do the "right thing", the programmer needs to type extra keystrokes as in "int i = 0;" but D works the other way around: "int i;" safely sets the variable to a default value (that in this case is zero). To make it uninitialized you have to spend extra effort and type "int i = void;" expressing that the uninitialized variable is intentional and not due to laziness.

D.NET is an experimental port of the D language to the Common Language Runtime. It consists of two parts, a front-end and a back-end component. The front-end component handles the parsing of source code and the generation of abstract syntax trees. The back-end compiler takes that and generates the actual machine code, or in this case IL code. While the source for both are available on CodePlex, only the back-end is maintained there. The front-end component is straight out of the D 2.0 Programming Language Compiler.

A word of caution,

The back-end code is not of production quality, it is intended for research and educational purposes. The D Programming Language is a fairly complex language, and non-trivial features such as TLS and closures make it an interesting case study for generating IL code.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

D.NET Loses Something by Eric Smith

When I learned about D (and wrote a teeny bit of code with it) a few years back, it looked extremely interesting. Here was a language that was appropriate for native/system coding but that had features of more modern environments compared to C++, like garbage collection, unit testing and design by contract.

I'm not sure that a .NET targeted compiler is quite as compelling when compared to C#, but it would be cool to see D take off for cases when native code is more appropriate.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT