It is the year 2020: why should I use / learn D?

Isaac S. spam-no-reply-isaac at outlook.com
Wed Nov 14 22:49:22 UTC 2018


On Wednesday, 14 November 2018 at 15:07:46 UTC, lagfra wrote:
> TL;DR: what will D offer with respect to C++ when almost all 
> key features of D are present in C++20(+)?

1. I personally love D's really clean syntax, semantics, and 
standard library. I also love most of the type system; especially 
that almost all types have clearly defined sizes. D's overall 
great design is the reason why I picked it. I don't think its 
possible for C++ to ever attain that as doing so would 
practically be making a whole new language.

2. One thing that I don't think gets enough love in D is the fact 
_everything_ is initialized with a default value (unless you ask 
it not to). It's frustrating the amount of time I've wasted 
debugging code in C++ due to forgetting to initialize one 
variable.

3. Unless I missed something, C++ still doesn't have anything 
like inout, which removes the need to duplicate property 
functions for const and non-const.

4. I like Dub. While it could use a few improvements, I find it 
is still _far_ more usable than make or cmake.

The thing with the features you listed being added to C++ is that 
most of them are already in D and in the libraries programmed in 
D. I remember hearing about modules in C++ last year, and they 
still are not usable. Having to maintain a separate header file 
is one the big reasons (but not the only) I decided against C++.

Even when these features are available, many code bases won't use 
them for a while because they want to maintain compatibility. 
This is especially true on Linux where different distros will 
have different major versions of GCC and Clang.


More information about the Digitalmars-d mailing list