Description #
D is a high-performance systems programming language that combines the speed and power of C and C++ with modern syntax, safety features, and productivity improvements. It supports both low-level programming and high-level abstractions.
History #
The D programming language was created by Walter Bright of Digital Mars in the early 2000s and later co-designed with Andrei Alexandrescu. It was designed to fix long-standing issues in C++ while maintaining similar capabilities. D offers features like garbage collection, contract programming, and compile-time function execution, making it suitable for systems programming, app development, and game engines.
Hello World Code #
import std.stdio;
void main() {
writeln("Hello, World!");
}
How to Run #
Option 1: Online
- RunD – Official Online Compiler
- Replit – D
Option 2: Local
Install the DMD compiler or use apt
:
sudo apt install dmd
Save as hello.d
and run:
dmd hello.d
./hello
Key Concepts #
- Compiled, fast, and statically typed
- Mix of low-level and high-level programming
- Optional garbage collection
- Native support for unit tests
- Template metaprogramming
- Compile-time function execution (CTFE)
- Contract programming (in/out/invariant)
- Interoperable with C code
- Built-in concurrency and messaging
- Modules and package system
Try It Online #
Fun Facts #
- D can compile and run C code directly.
- It’s one of the few systems languages with built-in unit testing.
- Andrei Alexandrescu, co-designer of D, also contributed to C++’s standard library.