D - more or less power than C++?

Mike Capp mike.capp at gmail.com
Fri Mar 3 15:22:45 PST 2006


In article <duab09$1arn$1 at digitaldaemon.com>, Walter Bright says...
>
>I started a new thread for this:
>
>"Mike Capp" <mike.capp at gmail.com> wrote in message 
>news:dua67i$12cr$1 at digitaldaemon.com...
>> 7. D has all (well, most of) the power of C++
>
>I see this often and am a bit perplexed by it. What power do you feel is 
>missing?

Clean, composable, deterministic resource management. I know C++ is a horrific
Frankenstein's monster of a language, but it allows you to encapsulate resource
management better than anything I've ever seen. I find this frustrating, because
it's not as if D is far off. It might be that auto class members are all that's
needed. But I've ranted this rant many times before on this NG, and nobody else
seems particularly interested, so I won't repeat it here.

Oddly, I don't really agree with most of the other replies. Standard library -
meh. I'm not that impressed by the C++ standard library. It's terribly terribly
clever, but not actually all that useful relative to the price you pay for using
it. IDEs/toolchains - as I just said in another post, none of these offer much
more than a decent text editor, and they're downright embarrassing compared to
what's available for C# and Java. Libraries - nah. With no ABI, C++ is dead in
the water as a modular programming language. Personally I don't use any C++ libs
that don't come wrapped in C APIs.

>And what about the missing power in C++ - inline assembler, nested 
>functions, contract programming, unit testing, automatic documentation 
>generation, static if, delegates, dynamic closures, inner classes, modules, 
>garbage collection, scope guard?

Oh, I don't dispute any of that. Nested functions are great. The contract stuff
is pretty good. The unit testing isn't quite the way I'd want it, but I've had a
peek at the Phobos guts and it wouldn't take much to get there. Delegates and
scopeguard are both very nice. Modules and static if, hallelujah. GC, fine as
far as it goes. (The current GC is severely suboptimal, and making it better
will break other stuff. And I still get very annoyed by the claim that GC is
'optional' in D.)

I'm happy to grant that on balance, maturity issues aside, D is more powerful
than C++.

But that's not really the point. If you're trying to convince someone with a
substantial investment in C++ to switch to D, one of the most important
questions you want them to be asking is "What do I have to lose?". The
conclusion you want them to come to is "Nothing". If instead the immediate and
vehement answer is "Well, THIS!", you've suddenly lost a lot of momentum. That's
all I was getting at.

Drifting off-topic: in my not-very-original opinion, the killer app for the Next
Big Systems Programming Language will be the ability to take advantage of
multi-core hardware. (Almost certainly through some sort of functional approach
with compiler-verifiable restrictions.) C++ at this point is constitutionally
incapable of making that leap. It'll be interesting to see whether D can.

cheers,
Mike





More information about the Digitalmars-d mailing list