C++ to catch up?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Nov 5 09:55:17 PST 2012


On Mon, Nov 05, 2012 at 01:19:04PM +0100, jdrewsen wrote:
> On Monday, 5 November 2012 at 11:39:54 UTC, Erèbe wrote:
> >On Monday, 5 November 2012 at 10:00:29 UTC, jdrewsen wrote:
> >>It seems like the C++ committee is speeding up development
> >>adding lots of the goodies from D like Ranges, static if,
> >>template contraints etc.
> >>
> >>Will D still have a case when C++ gets this done?
> >>
> >>I wonder if Andrei is part of the C++ Ranges Study Group?
> >>
> >>The Future of C++:
> >>http://channel9.msdn.com/Events/Build/2012/2-005
> >>
> >>/Jonas
> >
> >http://forum.dlang.org/thread/iokgislnlzsvsosmqbbv@forum.dlang.org
> 
> I didn't read all of that thread because of the title "D vs C++11" -
> but it does list some very good arguments in favour of D.
> 
> I'll stop the emergency port of my D project to C++ then :P
[...]

The thing you've to understand about C++ is that it is an old,
widely-adopted language, and therefore it needs to maintain backward
compatibility with the very large existing codebase. This prevents it
from truly cleaning up some of the earliest design flaws, because that
will break just about every C++ program ever written, which is something
the C++ committee pretty much will never do.

We're already seeing a little bit of this effect in D; introducing
breaking changes OT1H lets us clean up the language and make it much
better, but it also alienates a lot of existing users. That's why Walter
has stated that there must be no more breaking changes, even if it is to
fix what is in retrospect a poor language design decision. This limits
how much we can do to fix existing design issues.

D had the advantage that it could learn from C++'s mistakes and do
things better. C++ doesn't have that benefit; it can introduce new
features, but the old flaws that still plague the language must live on.
The horribly ambiguous template syntax, for example, will continue to
live on. C++ will continue being the language that must be parsed before
it can be lexed. The ctor, copy ctor, etc., mess, must still live on.
Operator overloading will never have the convenience of D's compile-time
string-based approach, which allows very nice ways of reducing
boilerplate code. Etc., etc..

And new features must work around existing syntax in order to not break
existing code, which means nice syntax like D's templates, aliases,
etc., will never be as nice as they are in D.

I used to be big on C/C++ before I found D. From my admittedly biased
POV, though, C++11 (and beyond) is "too little, too late". I remember
being really excited when I first found out about C++11 (back when it
was still called C++0x -- it didn't make it before the turn of the
decade). Finally, I thought, here was the long-needed language update
that everyone's been waiting for. Well, I have to say that I felt quite
deflated after reading the spec summary. Yes it introduced some new
innovations which I liked, and some fixes to the most glaring language
flaws. But it was too little, too late. It took way too many years to
finalize, which meant many more years before wide adoption and
availability of conforming implementations. And it *still* didn't fix
all of the fundamental flaws in the language.

Not long afterwards, I found D, and that was the end of C++ for me. Yes
D does have its warts, but in spite of it all it's still superior to C++
in many fundamental ways.


T

-- 
Guns don't kill people. Bullets do.


More information about the Digitalmars-d mailing list