Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 13, 2026·3 min de lecture

D — Systems Programming Language Bridging High-Level and Low-Level Code

D is a systems programming language with C-compatible performance that adds modern features like garbage collection, closures, and compile-time function execution.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
D Language Overview
Commande d'installation directe
npx -y tokrepo@latest install 8be2b07b-7ef8-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

D is a systems programming language designed as a practical alternative to C and C++. It retains compatibility with C ABIs and header files while adding modern features such as garbage collection, first-class functions, and compile-time evaluation. D has been in development since 2001 and is maintained by the D Language Foundation.

What D Does

  • Compiles to efficient native code via DMD, LDC (LLVM), or GDC (GCC) backends
  • Provides direct C and C++ ABI interoperability without wrappers
  • Supports compile-time function execution (CTFE) for code generation
  • Includes a standard library (Phobos) with ranges, algorithms, and concurrency
  • Offers optional garbage collection with the ability to use manual memory management

Architecture Overview

D has three compiler implementations: DMD (reference compiler), LDC (LLVM-based for optimized output), and GDC (GCC-based). All produce native binaries. The language supports a unique range-based iteration model that underpins the standard library algorithms. CTFE allows arbitrary D code to execute at compile time, enabling powerful metaprogramming without separate tooling.

Self-Hosting & Configuration

  • Install DMD or LDC via package managers, or use the install.sh script from dlang.org
  • Manage projects and dependencies with dub, the D package manager and build tool
  • Configure builds in dub.json or dub.sdl files
  • Cross-compile using LDC with target triple flags
  • Use rdmd for script-like execution of single-file programs

Key Features

  • Three compiler backends (DMD, LDC, GDC) for different optimization needs
  • Compile-time function execution (CTFE) for zero-cost abstractions
  • String mixins and template metaprogramming for code generation
  • Ranges and algorithms for composable lazy data processing
  • Direct extern(C) and extern(C++) interop with existing codebases

Comparison with Similar Tools

  • C++ — C++ has a larger ecosystem but more complexity; D simplifies many patterns while maintaining similar performance
  • Rust — Rust enforces memory safety via borrow checking; D offers optional GC and a gentler learning curve
  • Go — Go is simpler with built-in concurrency; D provides more low-level control and metaprogramming
  • Nim — Nim compiles via C with Python-like syntax; D has C/C++ syntax familiarity and three mature compiler backends
  • Zig — Zig is minimal with no hidden control flow; D is higher-level with GC, exceptions, and a rich standard library

FAQ

Q: Is D garbage collected? A: D includes an optional GC. You can disable it and use manual memory management or allocators for performance-critical code.

Q: Can D call C libraries directly? A: Yes. D supports extern(C) declarations, and tools like dstep can auto-generate D bindings from C headers.

Q: Who uses D in production? A: Companies including eBay, Netflix, and Mercedes-Benz have used D for performance-sensitive backend systems and tooling.

Q: How does CTFE work? A: Any D function without side effects can be evaluated at compile time. The compiler literally runs the function during compilation and embeds the result in the binary.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires