Thread overview
D compiler for .NET
Jun 09, 2009
Jason House
Jun 10, 2009
Daniel Keep
Jun 10, 2009
Jason House
Jun 10, 2009
Jason House
Jun 10, 2009
Bill Baxter
Jun 10, 2009
Kagamin
Jun 10, 2009
Jason House
Jun 10, 2009
Kagamin
Jun 12, 2009
Tim Matthews
June 09, 2009
Earlier today, I tried to use the D compiler for .NET from http://dnet.codeplex.com/

Beyond compilation of the compiler, I found zero instructions on what to do next.  How do I integrate the compiler into the .NET framework/visual studio?  I'd like to be able to add D files to existing solutions (with C# code).  If I can do that, I'll probably push for some small adoption of D at work.  (I'm hoping mixins and templates will inspire the initial use of D)

Any tips or documentation on how to get started would be appreciated.

June 10, 2009

Jason House wrote:
> Earlier today, I tried to use the D compiler for .NET from http://dnet.codeplex.com/
> 
> Beyond compilation of the compiler, I found zero instructions on what to do next.  How do I integrate the compiler into the .NET framework/visual studio?  I'd like to be able to add D files to existing solutions (with C# code).  If I can do that, I'll probably push for some small adoption of D at work.  (I'm hoping mixins and templates will inspire the initial use of D)
> 
> Any tips or documentation on how to get started would be appreciated.
> 

"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."

Why do people never read the big red label saying "Warning: not ready for use!"?

As for VS integration, so far as I know, there isn't any.  I'm also fairly certain that you can't combine different languages in a single project period.
June 10, 2009
Daniel Keep Wrote:

> 
> 
> Jason House wrote:
> > Earlier today, I tried to use the D compiler for .NET from http://dnet.codeplex.com/
> > 
> > Beyond compilation of the compiler, I found zero instructions on what to do next.  How do I integrate the compiler into the .NET framework/visual studio?  I'd like to be able to add D files to existing solutions (with C# code).  If I can do that, I'll probably push for some small adoption of D at work.  (I'm hoping mixins and templates will inspire the initial use of D)
> > 
> > Any tips or documentation on how to get started would be appreciated.
> > 
> 
> "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."
> 
> Why do people never read the big red label saying "Warning: not ready for use!"?


Given the productivity increase that I could get, it's worth a shot.


> 
> As for VS integration, so far as I know, there isn't any.  I'm also fairly certain that you can't combine different languages in a single project period.

Solutions are collections of projects. Each project can be in a different language.
June 10, 2009
Jason House Wrote:

> Beyond compilation of the compiler, I found zero instructions on what to do next.
I believe it's a traditional CUI compiler. Compile the compiler, open command prompt and run the compiler with source files. I think, it will say if something is wrong.

> How do I integrate the compiler into the .NET framework/visual studio?
I think, the same way, as you would integrate any other .net language. See wikipedia for a list of them.

> I'd like to be able to add D files to existing solutions (with C# code).
I don't think this feature is available, the author was focused on making CUI compiler only. If VS allows integration of 3rd party compilers, you can use that.
BTW how do you plan to get support for D syntax highlighting and intellisense?
June 10, 2009
Kagamin Wrote:

> Jason House Wrote:
> > I'd like to be able to add D files to existing solutions (with C# code).
> I don't think this feature is available, the author was focused on making CUI compiler only. If VS allows integration of 3rd party compilers, you can use that.
> BTW how do you plan to get support for D syntax highlighting and intellisense?

I don't. While really cool, such features are not essential. What I'm really hoping to get out of this is proper generic programming and enhanced compile-time validation. Manual copying of boiler plate code with small tweaks is sickening.

June 10, 2009
Jason House Wrote:

>What I'm really hoping to get out of this is proper generic programming and enhanced compile-time validation.
> 
I think these are done by frontend and frontend was kept intact. He didn't even wanted to add .net-specific pragmas to the frontend.
June 10, 2009
Daniel Keep Wrote:

> "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."

I played around a bit more and it looks like D standard libraries don't compile and there's no access to any .NET libraries. There's a hack to give access to objects in System such as System.Console. I was able to use that to make hello world work. It's useless for my goals. There's no way I could use it at work :(
June 10, 2009
On Wed, Jun 10, 2009 at 2:12 PM, Jason House<jason.james.house@gmail.com> wrote:
> Daniel Keep Wrote:
>
>> "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."
>
> I played around a bit more and it looks like D standard libraries don't compile and there's no access to any .NET libraries. There's a hack to give access to objects in System such as System.Console. I was able to use that to make hello world work. It's useless for my goals. There's no way I could use it at work :(

As I was reading about C++/CLI recently, it made me wonder whether that might be a better model to follow to bring D to .NET.  C++/CLI is a managed .NET langauge, but it also interfaces seamlessly with native C++ code.   It introduces a bit of new syntax on top of C++ so that the managed classes and native classes can coexist.   For instance "ref class Foo {...}" declares a class that will be managed by the .NET VM.  "class Foo { ... }" remains as it is in C++, a native code class.

Clearly it would be cool if all existing D code could be made to just run unaltered on top of .NET, but this may be too much to hope for given that D was designed to down-to-the-metal, and .NET was not designed to host such langauges.

--bb
June 12, 2009
Jason House wrote:
> Earlier today, I tried to use the D compiler for .NET from http://dnet.codeplex.com/
> 
> Beyond compilation of the compiler, I found zero instructions on what to do next.  How do I integrate the compiler into the .NET framework/visual studio?  I'd like to be able to add D files to existing solutions (with C# code).  If I can do that, I'll probably push for some small adoption of D at work.  (I'm hoping mixins and templates will inspire the initial use of D)
> 
> Any tips or documentation on how to get started would be appreciated.
> 

It works from the command line like dmd but with ms vs tools like ilasm in your path too. Visual studio could probably make use of it but is there any D VS plugin projects that are not dead?

It uses D import files to call existing clr code but it only has a few things in the import files. It is possible to add stuff to the import files but the plan is to generate the imports automatically. It is pretty much very experimental at the moment and could do with the extra man power to get it going. Dmd front end in source control with proper documentation as you asked in D newsgroup would help a lot.

The import generator is mostly working but the generated imports are not parseable. http://d.puremagic.com/issues/show_bug.cgi?id=3061