100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Programming

D (language)

IntermediateLanguage7.1K learners

D is a systems programming language that combines the performance and low-level control of C and C++ with modern productivity features such as optional garbage collection, built-in unit testing, and compile-time metaprogramming.

#D#Language#Programming#Intermediate#Rust#Zig#Nim#Vala#SoftwareDevelopment#Glossary#SkillVeris

Definition

D is a systems programming language that combines the performance and low-level control of C and C++ with modern productivity features such as optional garbage collection, built-in unit testing, and compile-time metaprogramming.

Overview

D was created by Walter Bright at Digital Mars, first released in 2001, with the aim of reengineering C++ from experience — keeping the raw performance and systems-level capability that make C++ valuable, while removing much of its accumulated complexity and unsafe legacy baggage. D adopted a C-like syntax that makes it easy for C, C++, and Java programmers to read, while adding features that were, at the time, unusual to find together in a single systems language: an optional tracing garbage collector (which can be selectively disabled for real-time or embedded code), native support for design-by-contract programming (preconditions, postconditions, invariants), built-in unit tests declared directly alongside the code they test, and powerful compile-time function execution (CTFE) and template metaprogramming for generating specialized code without a separate preprocessor. D compiles to native machine code via its own reference compiler (DMD) as well as LLVM-based (LDC) and GCC-based (GDC) backends, giving it performance in the same class as C and C++ for most workloads. Its module system replaces the C preprocessor's textual #include with proper compiled modules and explicit imports, and D provides safe subsets of the language (marked @safe) that the compiler statically verifies to rule out common memory-safety errors, alongside @system and @trusted regions for code that genuinely needs low-level, unchecked access. D has found a lasting niche in game development, tooling, and performance-sensitive server software where teams want C++-class performance without C++'s build-time and safety pain points, and it has an active open-source ecosystem (Phobos standard library, DUB package manager) and commercial users such as Sociomantic/dunnhumby's ad-tech infrastructure and parts of Weka's storage systems. It has never displaced C++ at the scale of mainstream adoption, but it remains one of the more mature 'better C++' alternatives, predating and philosophically overlapping with later entrants like Rust and Zig.

Key Features

  • Optional, selectively disable-able tracing garbage collector for real-time or embedded code
  • Built-in unit testing blocks declared directly alongside the code they test
  • Design-by-contract support: preconditions, postconditions, and invariants
  • Compile-time function execution (CTFE) and template metaprogramming
  • Module system replacing the C/C++ preprocessor's textual header includes
  • @safe, @trusted, and @system attributes to statically bound memory-unsafe code
  • Multiple mature compiler backends: DMD, LDC (LLVM), and GDC (GCC)
  • Near-C/C++ level runtime performance with significantly less boilerplate

Use Cases

Game engine and game logic development requiring high performance
Systems and server software where C++-class speed is needed with less complexity
High-frequency or latency-sensitive applications using D's disable-able garbage collector
Command-line tools and utilities benefiting from fast compile-run iteration
Compile-time code generation and metaprogramming-heavy libraries
Modernizing or replacing legacy C/C++ codebases incrementally

Alternatives

Frequently Asked Questions