March 03, 2006
AgentOrange wrote:
> In article <duab09$1arn$1@digitaldaemon.com>, Walter Bright says...
>> I started a new thread for this:
>>
>> "Mike Capp" <mike.capp@gmail.com> wrote in message news:dua67i$12cr$1@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++? 
>>
>>
> 
> compile time reflection/metaprotocol suport for the win. 
> 
> 
> 
> 
> 

Agent, are you a WoW'er?
March 03, 2006
Walter Bright wrote:

> I started a new thread for this:
> 
> "Mike Capp" <mike.capp@gmail.com> wrote in message news:dua67i$12cr$1@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?

- Definable assignment/copy semantics for structs.

This (combined with end of scope destruction) allows automatic reference counted resource handles, ownership-transferals, and more.

- And of course, implicit function template instantiation, but I trust we will get that soon. :)

/Oskar
March 03, 2006
"Sean Kelly" <sean@f4.ca> wrote in message news:duad1t$1ehi$1@digitaldaemon.com...
> C++ has marginal inline asm support, even though no one supports the official syntax :-)

C++ has no inline asm, and there is no official syntax. There's only an "asm" keyword. That's it. You can have an official, standards compliant C++ compiler which launches all out nuclear assault upon seeing the asm keyword.

Many, but by no means all, C++ compilers implement an inline asm as an extension.

>> What does D have to do to have more power than C++?
> Better RTTI might be nice perhaps.

D already has better RTTI than C++.


March 03, 2006
"Thomas Kuehne" <thomas-dloop@kuehne.cn> wrote in message news:atumd3-ig8.ln1@birke.kuehne.cn...
>> What does D have to do to have more power than C++?
> 0)
> Stockpiles of projects / code - just like C++.

It can certainly use that, but that isn't a power language feature.

> 1) standard
> A standard instead of a "blah, blah, blah" documentation.
> (-> http://www.digitalmars.com/d/float.html)
> Enumerating statements in the documentation might be a start.

I agree that the D documentation is deficient. But that's not a power feature, either.

> 2) lib
> A decent standard lib. Decent isn't necessarily large, but useful,
> structured, documented and working.

D has many standard library capabilities that C++ doesn't have - like regex, for one. Better formatted I/O, for another. The only thing C++ has is STL.

> std.string.tolower/toupper corrupts input:
> toupper(tolower("a\u1000B"))

Bugs are a problem.

> 3) compiler
> C++ is available on how many architectures and OSs right now?

That's a great characteristic to have, but it isn't a power feature.

> 4) IDE support / tool chain
> <no comment>

Ancilliary support tools are important, but they aren't a power language feature, either. None of them are mentioned in the C++ standard.

> Granted there are some rough corners in the D feature collection, but I don't think that they are THE problem.

I agree.


March 03, 2006
"Mike Capp" <mike.capp@gmail.com> wrote in message news:duaj45$1pni$1@digitaldaemon.com...
> 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.

Ok, I understand that point. From one perspective, D makes for a lousy C++ compiler. If you try to transliterate traditional style C++ code in D, it isn't going to work too well. For example, if you try to use smart pointers, D will stymie such efforts. The benefits of D don't become apparent until one is willing to write things in a D style.


March 04, 2006
Walter Bright wrote:

> 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++? 

Some features that C++ has on the Mac OS X platform are:
- C programming model for SIMD / vectorization (Vec / SSE)
- 64-bit code generation (well, not for x86 yet but anyway)
- access to "Carbon" system headers, loads of old C macros
- the ability to co-exist with "Cocoa", using Objective-C++

Automatic documentation generation and inline assembler
are covered by Doxygen and by GCC, so I won't count those.
(C/C++ has inline assembler for PowerPC, while D doesn't.
I still prefer the output from Doxygen, while Ddoc matures)


Things that *are* possible in D, but needs some more work:
GDB - debugger support for code mangling and data structures
Xcode - full integration with system developer tools and IDE

So besides that templates are broken on "old" Mac OS X 10.3,
it works mostly the same as what C/C++ does on the platform.
(Some of the features requires patching both of GCC and GDB)

One thing that I *do* miss are the array literals, though.
The rest are more of implementation issues, not language.
As a language, I do like D a lot more than what I do C++...

--anders
March 04, 2006
In article <duab09$1arn$1@digitaldaemon.com>, Walter Bright says...
>
>I started a new thread for this:
>
>"Mike Capp" <mike.capp@gmail.com> wrote in message news:dua67i$12cr$1@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++?
>

I'm not a power programmer, so I can't talk much about what their needs are -- it sounds like you've already gotten some good input on what could make it more powerful. However, I think D is already powerful enough to be a big hit.

I'm going to go out on a limb and say Java isn't nearly as powerful as C/C++ is, but Java is more popular than C++ (according to http://www.tiobe.com/tpci.htm). It isn't so much about power as it is usability. With Java, you can just grab a single SDK, and you have just about everything you need -- and it just works. Comes with a nice IDE with all those cool completion features, and everything is just rather intuitive. It is easy to find and add external modules, and they are all auto-loaded. Java is a memory hog, and performance is generally much slower than C/C++... but Java is so damn usable, they don't mind giving up memory/CPU time. D is more powerful than Java already, and if it became as usable (or more), who would need Java? D takes first place... and you have millions of people writing libraries (in a nice, official format with a great and complete standard D library) to help push that 'powerful' bar up over even naive C++ programmers. :)

Jeremy
March 04, 2006
Walter Bright wrote:
> "Thomas Kuehne" <thomas-dloop@kuehne.cn> wrote
> 
>>>What does D have to do to have more power than C++?
>>
>>3) compiler
>>C++ is available on how many architectures and OSs right now?
> 
> That's a great characteristic to have, but it isn't a power feature.

Depends on who you ask.

Define "power feature".
March 04, 2006
"Andrew Fedoniouk" <news@terrainformatica.com> wrote in message news:duajvt$1re3$1@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.


March 04, 2006
"Oskar Linde" <olREM@OVEnada.kth.se> wrote in message news:duak88$1rmh$1@digitaldaemon.com...
> - Definable assignment/copy semantics for structs.
>
> This (combined with end of scope destruction) allows automatic reference counted resource handles, ownership-transferals, and more.

True, but the need for these are relatively insignificant in D, since D has gc and on_scope.