It is the year 2020: why should I use / learn D?
Guillaume Piolat
first.last at gmail.com
Wed Nov 14 15:27:37 UTC 2018
On Wednesday, 14 November 2018 at 15:07:46 UTC, 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
>
Not all implementations are equal.
- Regarding `constexpr`
For example D's CTFE works by having some places where things are
forced to be evaluated in CTFE. No syntax.
In C++, you currently have `constexpr` and soon you'll have
`consteval` alongside with constexpr
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r2.html). No new keyword was used for the D version of CTFE.
Similarly, `if constexpr` is strictly less useful than `static
if` since it introduces a scope. See the workaround here:
https://stackoverflow.com/questions/46880578/scope-of-variables-declared-inside-if-constexpr-blocks < back to where we were with enable_if in terms of code size.
Regarding modules, they were proposed and reported in two C++
standards already.
Same for concepts.
Ultimately all this doesn't matter much since:
- the C++ culture of using cmake/makefiles over a declarative
build system will not change (see the demise of biicode)
- avoiding the latest language addition to keep compatibility is
necessary in C++, with divergent frontends
- existing codebases are still C++98 for the most part
D has the chance to have a community :
- for which template meta-programming is simple, well understood
and almost boring
- which is willing to build an ecosystem (but not enough)
>
> what are the advantages of using D vs C++ if my goal is to
> build a complex system / product?
Easy: your struggle to learn the D language will have an ending.
Which lead to reduced mental load forever - without compromising
anything in power.
> TL;DR: what will D offer with respect to C++ when almost all
> key features of D are present in C++20(+)?
Sanity.
More information about the Digitalmars-d
mailing list