D, also known as dlang, is a multi-paradigm system programming language created by Walter Bright at Digital Mars and released in 2001.
Like C++, and unlike application languages such as Java and C#, D supports low-level programming, including inline assembler.
Classes (and interfaces) in D can contain invariants which are automatically checked before and after entry to public methods, in accordance with the design by contract methodology.
Many aspects of classes (and structs) can be introspected automatically at compile time (a form of reflective programming (reflection) using type traits) and at run time (RTTI / TypeInfo), to facilitate generic code or automatic code generation (usually using compile-time techniques).
Type inference may be used with an anonymous function, in which case the compiler creates a delegate unless it can prove that an environment pointer is not necessary.
This can be used to parse domain-specific languages, which will be compiled as part of the program: Memory is usually managed with garbage collection, but specific objects may be finalized immediately when they go out of scope.
In case more control over memory layout and better performance is needed, explicit memory management is possible using the overloaded operator new, by calling C's malloc and free directly, or implementing custom allocator schemes (i.e. on stack with fallback, RAII style allocation, reference counting, shared reference counting).
[15] The manual gives many examples of how to implement different highly optimized memory management schemes for when garbage collection is inadequate in a program.
However this can be changed for classes, for example using standard library template std.typecons.scoped, or by using new for structs and assigning to a pointer instead of a value-based variable.
Functions marked @safe are checked at compile time to ensure that they do not use any features, such as pointer arithmetic and unchecked casts, that could result in corruption of memory.
[21] Initially under the banners of DIP1000[22] and DIP25[23] (now part of the language specification[24]), D provides protections against certain ill-formed constructions involving the lifetimes of data.
An annotated example is given below.C's application binary interface (ABI) is supported, as well as all of C's fundamental and derived types, enabling direct access to existing C code and libraries.
[31] The first version of the language (D1) concentrated on the imperative, object oriented and metaprogramming paradigms,[32] similar to C++.
Being a community-led project, Tango was more open to contributions, which allowed it to progress faster than the official standard library.
The existence of two libraries, both widely in use, has led to significant dispute due to some packages using Phobos and others using Tango.
D2 later added numerous other language features, such as closures, purity, and support for the functional and concurrent programming paradigms.
[36] The release of Andrei Alexandrescu's book The D Programming Language on 12 June 2010, marked the stabilization of D2, which today is commonly referred to as just "D".
On 7 April 2017, the whole compiler was made available under the Boost license after Symantec gave permission to re-license the back-end, too.
WebAssembly target (supported via LDC and LLVM) can operate in any WebAssembly environment, like modern web browser (Google Chrome, Mozilla Firefox, Microsoft Edge, Apple Safari), or dedicated Wasm virtual machines.
Editors and integrated development environments (IDEs) supporting syntax highlighting and partial code completion for the language include SlickEdit, Emacs, vim, SciTE, Smultron, Zeus,[56] and Geany among others.
[57] Open source D IDEs for Windows exist, some written in D, such as Poseidon,[70] D-IDE,[71] and Entice Designer.
The ZeroBUGS Archived 23 December 2017 at the Wayback Machine debugger for Linux has experimental support for the D language.
[73] dub is a popular package and build manager for D applications and libraries, and is often integrated into IDE support.
The main function is the entry point of a D program, and args is an array of strings representing the command line arguments.
Notable organisations that use the D programming language for projects include Facebook,[75] eBay,[76] and Netflix.
[77] D has been successfully used for AAA games,[78] language interpreters, virtual machines,[79][80] an operating system kernel,[81] GPU programming,[82] web development,[83][84] numerical analysis,[85] GUI applications,[86][87] a passenger information system,[88] machine learning,[89] text processing, web and application servers and research.
The notorious North Korean hacking group known as Lazarus exploited CVE-2021-44228, aka "Log4Shell," to deploy three malware families written in DLang.
[90] The lack of transparency, agility and predictability in the process of getting corrections of known flaws and errors incorporated, and the difficulty of introducing minor and major changes to the D language, is imminently described in a blog post article[91] by a former contributor.