D vs C++11
Malte Skarupke
malteskarupke at web.de
Sat Nov 3 15:01:19 PDT 2012
On Friday, 2 November 2012 at 17:03:38 UTC, Erèbe wrote:
> Hello student here,
>
> I have started to learn D a few months ago with Andrei's book
> (I really liked arguments about design decisions), but as the
> same time I was learning new features of C++11, and now I'm
> really confused. (As learning projects, I've done an IRC Bot in
> D and an IPv6 stack in C++11)
>
> D is a great language and introduce a lot of features I really
> like (range, property, UFCS, great metaprogramming, ...) but
> C++11 and the new standard librairy are well supported now.
>
> I have some solid experience with C++, so I know how cumbersome
> C++ could be (C++11 and universal reference ?), but D has a lot
> of features too and (as C++) a slow learning curve.
>
> I would like to konw the point of view of the community about
> C++11 in regard of D ? Is the gap between D and C++11 is
> getting thinner ? Do you think D will keep attracting people
> while at the same time C++11 has more support (debugger, IDE,
> Librairies, Documentation) ?
I've learned C++ in the last two years and learned D in the last
couple months, and I slightly prefer C++ over D. When I started
using C++11, I took for granted that all the features just work.
Using D, I realize that that is actually unusual. In D you still
encounter compiler bugs or inconsistent behavior way too often,
and I have workarounds all over my code.
I also prefer C++ being much more explicit about everything it
does. For example I prefer the lambdas with a capture list over D
delegates.
And in D you've got the core runtime allocating memory without me
being aware of it all the time. Sure, it gets garbage collected
at some point, but I'd rather that it didn't do it at all.
D also makes the const keyword more annoying than it should be.
In C++ you typically use it as an indicator for the intent of the
interface and to prevent you from making mistakes. There are some
programmers who find it very annoying and who never use const. In
D I am leaning towards being one of those programmers, even
though I belong to the group who uses const more strictly in C++.
That being said I do think that I write better code in D, but I
wouldn't use it for real projects any time soon. It just isn't
ready, and I'm sure that my existing code will break several more
times in future compiler versions.
At the moment the issue is that C++11 is pretty good, and D is
not ready. So people will start using C++11 and they'll see that
it's good enough and they'll never migrate. The best features of
D don't matter if the language is a bit annoying as soon as you
leave the space of clean and nice examples.
More information about the Digitalmars-d
mailing list