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

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


On Tuesday, 26 February 2013 at 15:43:42 UTC, dennis luehring
wrote:
> Am 26.02.2013 16:26, schrieb Craig Dillabaugh:
>> 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++.
>
> i don't get it
>
> you are an novice D programmer and your programs are easy to 
> convert back to C++ so you'r not using too much D specials
>
> whats the point of doing it like this?

I should qualify that a bit. I don't avoid D features altogether,
but I don't necessarily use many of the advanced features (eg.
mixins) that might have no equivalent in C++. I work in
scientific computing so I do much of my work with arrays.
Working with D arrays is much, much nicer than in C++.  So I save
lots of time getting my algorithm working/tested.  Then the
porting is pretty simple, because while slices for example are
not supported in C++ you can handle the same logic in C++ without
too much trouble.  However, the C++ code is uglier and not having
to deal with that ugliness lets me focus my mental effort on the
details of my algorithm. This lets me implement it correctly more
quickly.

Using D associative arrays vs C++ std.map is another example.

Now, I would never suggest using D to prototype a full
application or anything like that, but at least for the type of
work I tend to do I find that using D lets me focus on my
'algorithm' without fight with awkward syntax.






More information about the Digitalmars-d mailing list