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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Nov 15 13:29:47 UTC 2018


On 11/14/18 4:07 PM, lagfra wrote:
> https://www.reddit.com/r/cpp/comments/9vwvbz/2018_san_diego_iso_c_committee_trip_report_ranges/ 
> 
> 
> By 2020 C++ is planning to introduce:
> 
> * Ranges
> * Contracts
> * Concepts (`__traits`)
> * Proper constexpr
> * Modules
> * Reflections
> * Green threads
> 
> Right now it already has:
> 
> * `auto` variables
> * Ranged for (`foreach`)
> * Lambda expressions and closures
> * `nothrow` attributes
> * Proper containers
> * Proper RAII
> 
> In no way this is the usual trollpost (I am a participant of SAoC). What 
> bugs me is the shortening distance regarding what D has to offer with 
> respect to C++. While D for sure has a way better syntax (thinking of 
> template declarations, `immutable`, UDAs) and a GC, what are the 
> advantages of using D vs C++ if my goal is to build a complex system / 
> product?
> 
> TL;DR: what will D offer with respect to C++ when almost all key 
> features of D are present in C++20(+)?

Thanks for asking. Saw several good answers, to which I feel compelled 
to add the following.

I just delivered the opening keynote for Meeting C++ 
(https://meetingcpp.com/2018/Schedule.html). The video will come about 
in a few days. There's a bit of a twitter storm going about.

I think C++ is not properly equipped for the next big thing, which is 
Design by Introspection. C++ has a history of poorly copying features 
from D while missing their core point, which makes the import much more 
difficult to use. The example I give in the talk is that C++ initially 
rejected everything and anything about static if, to then implement it 
under a different name ("whatever it is, make sure it's not static if!") 
and entirely missing the point by having if constexpr insert a new scope 
(whereby NOT introducing the scope is the entire point of the feature in 
the first place).

So going through the motions is far from achieving real parity. At the 
same time C++ is spending a lot of real estate on language features of 
minor impact (concepts) or mere distractions (metaclasses), both of 
which aim squarely not at solving difficult issues in problem space, but 
to patch for difficulties created by the language itself.


Andrei




More information about the Digitalmars-d mailing list