D - more or less power than C++?
Bruno Medeiros
daiphoenixNO at SPAMlycos.com
Sat Mar 4 04:37:06 PST 2006
Walter Bright wrote:
> 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?
>
> 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?
>
> What does D have to do to have more power than C++?
>
>
Power is not an absolute measure. It is a collection of various aspects.
Saying that one thing is more powerful than the other can only be done
if that thing is more powerful than the other in *all* aspects. As it
currently stands D is more powerful than C++ in most aspects, but that
doesn't mean that there are some things that C++ is more powerful.
But this question is a bit biased and misframed. Power is relative and
subjective. "Power" can be good but can be bad too. Preprocessor offers
more "power", but is it "better"? That's what I mean when I say the
question "What does D have to do to have more power than C++?" is a bit
tricky.
Even for less infamous features than say, the preprocessor, there is
almost always a tradeoff in simplicity. Java is an extreme example of
this, where plainness and "shepherdness" are taken to an extreme, and I
hear people complain about it all the time (me inclusive), but I also
recognize that there are some advantages to this plainness.
_I know_, when reading Java code, that the code isn't doing some weird,
obscure, or just unclear thing, because Java is that plain. And that is
something I didn't immediately realize after learning/working with Java,
but only recently came to value and understand (and I think it might
very well be one of the things that were responsible for Java's popularity).
Now, I'm not saying (nor I think) that D should be like Java in that
regard, but I think it's something we should keep in mind when trying to
shove every feature of other language, especially C++, into D.
Walter already got it right in many things, like designing D without
preprocessor, multiple inheritance, or extensive operator overloading.
(this last point being brought into discussion here)
There is not much more in C++ that I could think is worth putting in D.
ITFI is already planned. struct constructors (and destructors?) perhaps
would be good too. As for extensive operator overloading (such as
overloading the assignment operator) I'm not so sure would be a good
idea, but I'm not knowledgeable enough to make an definite opinion.
But now, and the most important point I want to make, is that if D wants
to succeed as a modern language, all should start thinking about and
thinking of comparing D with modern languages (Java, C#, and others),
and not just with C++!
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list