D better than c++?

Hasan Aljudy hasan.aljudy at gmail.com
Wed Mar 22 12:55:20 PST 2006


ert wrote:
> how is D better than c++? any comments appreciated
> 
> 

D's syntax is simple, elegant and consistent. For example, the template 
syntax doesn't look any different from say, classes or functions.

In D, you don't need header files. Just write your functions, and if you 
need them in another file, just import the original file.

You don't need forward references. Write your functions/classes in any 
order you like!!

Classes are written in one block (like Java).

No :: or -> operators. Only the dot '.' is used, whether you're 
referring to a static function, an object reference, a struct pointer, a 
namespace, or anything like that, you just use the '.'.

Writing code is just so simple and easy with D. You just type your code 
away, without having to worry about any of the crap that C++/C gives you.

Namely,
* You don't need to split your definitions across multiple files.
* You don't need to worry about the 'lexical order' of the definitions.

D is also simpler to parse than C++ (by magnitudes). This makes possible 
for a set of helper tools, like the build tools, which reads your main 
source file, and automagically determine all the dependent files that 
need to be compiled. So you don't need to maintain a make file. If you 
have a large project with 50 files or more, you just need to call build 
and pass it the file that contains the main function. (That's a bit of a 
simplification, it's the general case, although there maybe some corner 
cases, but they are easy to deal with).









More information about the Digitalmars-d mailing list