D as a prototyping language (for C/C++ projects)

Craig Dillabaugh cdillaba at cg.scs.carleton.ca
Tue Feb 26 07:26:17 PST 2013


I am a novice D programmer and use C++ in my work. One thing I
find myself doing when I need to implement some non-trivial
algorithm is that I will originally code it in D and perform
testing from there to make sure I have the logic right.
Once I have everything working in D I simply port it over to C++.

In my experience this porting is very trivial (it probably helps
there that I write D like a C++ programmer). While I don't have
hard evidence I think that the 'porting' effort to C++ is more
than offset by the productivity gains I achieve fighting with C++
syntax while trying to get the logic right. Most of the porting
effort is simply copying and pasting the D code into my C++
source files and adding headers, replacing imports with includes,
etc. Usually significant portions of the code compile without any
changes.

I was curious to know if anyone else uses D like this. If so this
might be a good way to try and get D into some C++ shops.  The
nice thing about D in my opinion is that even for people without
D experience, if they have C++ experience they can likely 'read'
D code without much trouble (of course some features might not
map over so well - but the languages are syntactically very
close).


More information about the Digitalmars-d mailing list