D (programming language) facts for kids
Paradigm | multi-paradigm: procedural, object-oriented, functional, generic |
---|---|
Designed by | Walter Bright, Andrei Alexandrescu (since 2006) |
Developer | Digital Mars, Andrei Alexandrescu (since 2006) |
First appeared | 2001 |
Stable release |
2.071.1 / June 27, 2016
|
Typing discipline | strong, static |
OS | DMD: Unix-like, Windows, Mac OS X |
License | GPL/Artistic (DMD frontend), Boost (standard and runtime libraries), source available (DMD backend), Fully open-source (LDC and GDC) |
Filename extensions | .d |
Major implementations | |
DMD (reference implementation), GDC, LDC | |
Influenced by | |
C, C++, C#, Eiffel, Java, Python, Ruby | |
Influenced | |
MiniD, DScript, Vala, Qore | |
|
The D programming language is a special kind of computer language that helps people create software. It's like a set of instructions you give to a computer. D was designed to be a modern version of C++, another popular programming language.
D aims to be super fast, like C++, but also easy and safe to use, similar to newer languages. This means programs written in D can run very quickly. They can also be shorter and safer, helping to prevent common computer errors.
What is D Programming?
D is a multi-paradigm language. This means you can use different styles of programming with it. It supports object-oriented programming, where you organize code around "objects" that contain data and actions. It also supports procedural programming, which focuses on step-by-step instructions.
D was created by Walter Bright in 2001. Later, Andrei Alexandrescu joined the team to help improve it. Many other languages, like C, C++, and Python, influenced D's design. This means D takes some of the best ideas from these languages.
Why Use D?
D is often used for system programming. This means it's good for making software that works closely with a computer's hardware. For example, it can be used to create operating systems or tools that manage your computer.
One of D's main goals is to make programming easier and more fun. It tries to combine the speed of older languages with the helpful features of newer ones. This can lead to programs that are both powerful and simple to write.
How D Works
D is a compiled language. This means that before your computer can run a D program, the code you write needs to be translated into a language the computer understands directly. This translation process is done by a special program called a "compiler."
D also uses static typing. This means that when you write your code, you usually tell the computer what kind of data each variable will hold. For example, you might say a variable will store a whole number or a piece of text. This helps the compiler find mistakes early, before your program even runs.
Simple D Program Example
Let's look at a very basic D program. This program shows how D can print information to your screen.
import std.stdio: writefln;
void main(string[] args)
{
foreach (i, arg; args)
writefln("args[%d] = '%s'", i, arg);
}
- The `main` function is where your D program always starts. It's like the main entrance to a building.
- `args` is a list of words you might type when you run the program.
- The `foreach` statement is a handy way to go through each item in a list. Here, it goes through each word in `args`.
- `writefln` is a command that prints text to your screen. It's like saying "show this message!"
This simple example shows how D can handle basic tasks. It's designed to be clear and easy to read, even for beginners.
See also
In Spanish: D (lenguaje de programación) para niños