D - more or less power than C++?
Walter Bright
newshound at digitalmars.com
Fri Mar 3 17:19:27 PST 2006
"Andrew Fedoniouk" <news at terrainformatica.com> wrote in message
news:duajvt$1re3$1 at digitaldaemon.com...
>> What does D have to do to have more power than C++?
> 1) C++ has ctors/dtors for stack allocated objects. This problem
> is known in D as luck of struct ctor/dtor.
The following:
auto Foo f = new Foo();
has ctor/dtor semantics. It isn't allocated on the stack at the moment, but
there is no semantic reason why it couldn't be. Allocating it on the heap is
an artifact of dmd, and not of the language.
> 2) C++/C both have const.
>
> These two are corner stones in C++ (among others).
> The whole std:: namespace without them is just impossible.
>
> I cannot imagine serious *library* design without 'const' for example.
> Library here means design of robust code used by millions.
> Phobos imho will never be considered as something rock-solid without
> 'const'.
I don't really understand this, as many languages have serious libraries
without const - such as Java, Python, C#, etc.
> E.g. I have tried three or four different approaches
> to reproduce string value type in D. Just no way.
> Everything what I've seen so far is non-comparable
> with even std:string and I am yet silent about .NET and Java.
I don't understand what you mean.
> Big picture: templates (at some extent) and
> definitely delegates are superior in D than in C++.
> Other features are more or less elegantly reproducible in C++.
Try doing nested functions elegantly in C++ <g>.
> D used to have clean,consistent and simple syntax and execution model
> (e.g. GC "from the shelf") but holes 1) and 2) on the bottom of this ship
> are just shining.
I'm not sure why (1) and (2) didn't exist in the way D used to be.
More information about the Digitalmars-d
mailing list