D - more or less power than C++?
Jari-Matti Mäkelä
jmjmak at utu.fi.invalid
Sun Mar 5 13:40:41 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?
Nothing significant.
>
> 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++?
I think besides bugs and template/array-issues D is almost ready. One
major thing that's bugging me though is the role of interfaces in D.
I've always thought that D should use interfaces like Java does. Still D
(according to the BNF-syntax in the docs) introduces protection
attributes to class inheritance. OTOH a trivial test case shows that
(luckily) they are not implemented (at least not the way C++ uses them).
IMHO they're not welcome at all, if we are going to support accessing
classes via interface references:
interface foo { (public) void abc() { ... } }
class bar : private foo // something very wrong here
{}
void main() {
foo obj = new bar();
obj.abc();
}
The private-protection forces C++ to do a runtime check on the 7. row
and prevent the use. This is complete insanity. Also .sort:ing and other
important operations don't really work currently with the arrays of
interface references to different derived classes of foo. As a
workaround abstract classes must be used as interfaces, but this
prevents the emulation of multiple inheritance. As far as I understand
these interface references aren't as efficient as class references but
they're still damn useful for many practical (non-time critical) purposes.
--
Jari-Matti
More information about the Digitalmars-d
mailing list