Because it was designed many years after the advent of most of the main programming languages that form the
backbone of our software (C, C++, Java, Python, etc.), D has the benefit of 20/20 hindsight that it uses to
improve over some quite glaring flaws in earlier languages.
</p>
<p>
From our past, we've learned a few key things which contribute to great languages:
</p>
<ul>
<li><strong>Expressiveness</strong>: it should be very easy to express complex structures and processes.</li>
<li><strong>Abstraction</strong>: programmers should be able to create abstractions without significant extra cost.</li>
<li><strong>Ease of use</strong>: it should be really easy for new programmers to get started, and for pros to do things quickly.</li>
<li><strong>Performance</strong>: programs written in the language should be reasonably efficient and fast.</li>
</ul>
<p>
Of the other languages I've mentioned, each of those easily achieves a few of these requirements: C++
is expressive and allows efficient abstraction, and it's very fast. However, it's generally accepted that
the learning C++ is quite difficult. Again, Python can arguably meet the first three requirements, but fails
to provide satisfactory performance for many applications.
</p>
<p>
I think that D is a language which addresses all of these requirements in a modest, satisfactory approach.
</p>
<ul>
<li>D allows the same level of expressiveness as C++, while offering the convenience of Java when you don't want that.</li>
<li>Abstraction in D is as simple as in Java.</li>
<li>D is relatively easy to learn, because of its simple module structure and automatic memory management by default.</li>
<li>Because D compiles to machine code, it is inherently open to all sorts of optimizations from LLVM and GCC compiler backends, earning it very good performance that's faster than Java but just shy of C++ in most cases.</li>
</ul>
<figure>
<pre><codeclass="language-d">
import std.stdio, std.array, std.algorithm;
void main() {
stdin
.byLineCopy
.array
.sort!((a, b) => a > b) // descending order
.each!writeln;
}
</code></pre>
<figcaption>This program sorts lines of input from <code>stdin</code> in alphabetical order and prints them.</figcaption>
</figure>
<figure>
<pre><codeclass="language-java">
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main {
public static void main(String[] args) throws IOException {
try (var in = new BufferedReader(new InputStreamReader(System.in))) {
in
.lines()
.sorted(String::compareTo)
.forEachOrdered(System.out::println);
}
}
}
</code></pre>
<figcaption>An equivalent program written in Java.</figcaption>
</figure>
<p>
Of course, I could list all of the language features here which allow D to excel in each of the basic
requirements, but in short, it offers all of the power of a low-level systems language like C++, while at
the same time offering the convenience of high-level languages like automatic memory management, and
metaprogramming. So, I think that D is somewhat unique in that it gives programmers a freedom to choose
their own preferred style; it's a language accomplishes as much as a family of languages.