Est. 2001 Intermediate

D

A systems programming language that combines the power and efficiency of C and C++ with modern conveniences like garbage collection, built-in arrays, and metaprogramming.

Created by Walter Bright

Paradigm Multi-paradigm: Object-Oriented, Procedural, Functional, Metaprogramming
Typing Static, Strong, Inferred
First Appeared 2001
Latest Version DMD 2.112 (2026)

D is a systems programming language designed to be a practical successor to C and C++, retaining their raw efficiency and low-level access while adding modern language features like garbage collection, first-class arrays, closures, and powerful compile-time metaprogramming. Created by Walter Bright, a veteran compiler engineer, D aims to solve the problems that have plagued C and C++ developers for decades without sacrificing the performance that makes those languages essential.

History & Origins

D’s story begins with Walter Bright, a mechanical engineer turned compiler writer who had spent over a decade building commercial C and C++ compilers at Zortech and later Digital Mars. Through years of implementing every corner of the C++ specification, Bright became intimately familiar with the language’s design flaws, inconsistencies, and the ways its complexity hindered both users and implementers.

In 1999, Bright began work on a new language that would preserve C’s efficiency and Algol-style syntax while eliminating what he saw as the accumulated design mistakes of C++. The first public release came on December 8, 2001, when the DMD (Digital Mars D) compiler was made available. The language was intentionally named “D” as a nod to its lineage as a successor in the C family of languages.

The early years of D were very much a one-person effort. Walter Bright designed the language, wrote the compiler, and maintained the standard library largely on his own. This changed significantly in 2006-2007 when Andrei Alexandrescu, already famous in the C++ world for his book Modern C++ Design and his work on template metaprogramming, became involved in D’s design and development. Alexandrescu brought rigorous academic thinking about programming language design, and his influence reshaped many aspects of the language.

D1 vs D2

A pivotal moment came in 2007 when D version 1.0 was released in January, and work on D version 2 (D2) began almost immediately, with its first release in June 2007. D2 was not merely an incremental update but a substantial rethink of several language features, particularly around immutability, purity, and the type system. This split caused significant community friction: D1 and D2 were incompatible in important ways, and the community had to navigate the transition period.

The library ecosystem also experienced a split during this era. The official standard library, Phobos, competed with an alternative community library called Tango. This division fragmented the ecosystem until the community eventually consolidated around Phobos for D2.

Design Philosophy

D’s design philosophy can be summarized as “practical systems programming with modern conveniences.” The language sits in an unusual space: it offers the low-level control of C (inline assembly, pointers, manual memory management when needed) alongside high-level features typically found in scripting languages.

Core design principles include:

  • Compatibility over revolution: D maintains ABI compatibility with C, allowing direct calls to C libraries without wrapper code. It can also link with C++ code in many cases.
  • Compile-time power: D’s template system and compile-time function execution (CTFE) enable metaprogramming that would require separate code generators in other languages.
  • Sensible defaults: Features like built-in array bounds checking, default initialization of variables, and garbage collection reduce common bug categories while allowing opt-out for performance-critical code.
  • Readability: Despite its power, D aims to be readable and maintainable, avoiding the syntactic complexity that can make C++ code difficult to follow.

Key Features

Compile-Time Function Execution (CTFE)

One of D’s most distinctive features is its ability to execute arbitrary functions at compile time. This goes far beyond simple constant folding — D can run complex algorithms, parse strings, and generate code during compilation:

1
2
enum factorial(int n) = n <= 1 ? 1 : n * factorial(n - 1);
static assert(factorial(10) == 3628800);

Template Metaprogramming

D’s templates are cleaner and more powerful than C++ templates, supporting variadic parameters, constraints, and static introspection:

1
2
3
4
5
6
void print(Args...)(Args args) {
    foreach (arg; args) {
        write(arg);
    }
    writeln();
}

Mixins

String mixins allow code generation from strings computed at compile time, while template mixins provide controlled code injection:

1
2
3
4
5
6
7
8
mixin template Singleton(T) {
    static T instance;
    static T getInstance() {
        if (instance is null)
            instance = new T();
        return instance;
    }
}

Contract Programming

D has built-in support for Design by Contract, including preconditions, postconditions, and class invariants — features inspired by Eiffel:

1
2
3
4
5
6
int sqrt(int n)
in (n >= 0, "n must be non-negative")
out (result; result * result <= n && (result + 1) * (result + 1) > n)
{
    // implementation
}

Ranges and Algorithms

D’s standard library is built around the range abstraction, a generalization of iterators that enables lazy, composable data processing pipelines:

1
2
3
4
auto result = iota(1, 100)
    .filter!(n => n % 3 == 0)
    .map!(n => n * n)
    .take(5);

Memory Management Options

While D provides garbage collection by default, it also supports manual memory management through malloc/free, @nogc annotations to guarantee GC-free code paths, and the scope keyword for deterministic destruction. This flexibility allows developers to choose the right approach for each component.

Compiler Ecosystem

D has three production-quality compilers:

  • DMD: The reference compiler, maintained by Walter Bright. Fast compilation, ideal for development.
  • LDC: An LLVM-based compiler that produces highly optimized native code.
  • GDC: The GCC-based D compiler, included in the GCC compiler suite since GCC 9 (2019), bringing D to most GCC-supported platforms.

This multi-compiler ecosystem gives D excellent cross-platform support and allows developers to choose between compile speed (DMD) and runtime performance (LDC/GDC).

Community and Ecosystem

The D Foundation, established in 2015 as a 501(c)(3) non-profit, stewards the language’s development. DConf, the annual D language conference, has been held since 2013, bringing together core developers and the community.

D’s package manager, DUB, provides access to a growing ecosystem of libraries. The language has active forums, a wiki, and regular community contributions to the compiler and standard library, all coordinated through GitHub.

The Adoption Challenge

Despite its technical merits, D has struggled to achieve the widespread adoption that some predicted. Several factors have contributed to this:

  • The D1/D2 split and Phobos/Tango library fragmentation disrupted early momentum
  • The garbage collector, while optional, created perception issues among systems programmers
  • Competition from Rust (for safety-focused systems programming) and Go (for practical systems work) intensified after 2010
  • Corporate backing has been limited compared to languages sponsored by major tech companies

Yet D has found a loyal following among developers who value its unique combination of low-level control and high-level expressiveness, particularly in domains where compile-time computation and metaprogramming provide significant advantages.

Current Relevance

D remains an actively developed language with regular compiler releases and an engaged community. Its influence can be seen in features adopted by newer languages — compile-time function execution, ranges, and contract programming have appeared in various forms across the language landscape. For developers working in systems programming who find C++ too complex and Rust’s ownership model too restrictive, D continues to offer a compelling middle ground.

Timeline

1999
Walter Bright begins designing D as an improved successor to C and C++
2001
First public release of DMD (Digital Mars D) compiler on December 8
2007
D version 1.0 released in January; Andrei Alexandrescu joins the project; D2 development begins in June
2010
Andrei Alexandrescu publishes 'The D Programming Language' book
2011
D source code moved to GitHub; Phobos standard library stabilizes for D2
2012
D1 officially discontinued with final release v1.076
2013
First DConf held in Menlo Park, California
2015
D Foundation established as a 501(c)(3) non-profit organization
2017
DMD compiler backend re-licensed under Boost Software License
2019
GDC (GCC-based D compiler) included in GCC 9 release, bringing D to most GCC-supported platforms
2020
'Origins of the D Programming Language' published in ACM HOPL IV proceedings
2026
DMD 2.112.0 released in January; active development continues

Notable Uses & Legacy

Facebook/Meta

Built Warp, a fast C/C++ preprocessor written in D and open-sourced in 2014. Hosted the first DConf in 2013 at Facebook HQ. Andrei Alexandrescu championed D's use internally.

Sociomantic (later acquired by dunnhumby)

Built their real-time advertising bidding platform in D, reportedly handling billions of ad auctions per day.

eBay

Used D for large-scale data mining tools, specifically high-performance command-line utilities for processing tabular data.

Weka.IO

Built a high-performance distributed file system using D, leveraging its systems programming capabilities.

Symmetry Investments

A global alternative investment company that uses D extensively and is a significant financial sponsor of the D Language Foundation.

Language Influence

Influenced By

Influenced

Vala Genie Qore

Running Today

Run examples using the official Docker image:

docker pull dlang2/dmd-ubuntu

Example usage:

docker run --rm -v $(pwd):/app -w /app dlang2/dmd-ubuntu sh -c 'dmd -run hello.d'
Last updated: