D programming language
|
- There have been several programming languages called D during the history of computing. This article is about the one created by Walter Bright. Dialog Manager is discussed on another page.
D is an object-oriented, imperative systems programming language designed by Walter Bright of Digital Mars as a successor to C++. Some other successors to C++ include Java, and C#.
D adds modern features like design by contract, unit testing, true modules, automatic memory management (garbage collection), first class arrays, closures (anonymous functions), and a reengineered template syntax. D retains C++'s ability to do low-level coding, and adds to it with support for an integrated inline assembler. C++ multiple inheritance is replaced by single inheritance with interfaces. D's declaration, statement and expression syntax closely matches C++.
The inline assembler is typical of the differentiation between D and application languages like Java and C#. An inline assembler allows a programmer to enter machine-specific assembly code alongside standard D code—a technique often used by systems programmers to access the low-level features of the processor needed to run programs that interface directly with the underlying hardware, such as operating systems and device drivers.
Memory is usually managed with garbage collection, but specific objects can be finalized immediately when they go out of scope. Explicit memory management is possible using overloaded operators new and delete, as well as simply calling C's malloc and free directly. It is also possible to disable garbage collection for individual objects or an entire program if more control over memory management is desired.
C's ABI (Application Binary Interface) is supported as well as all of C's fundamental and derived types, enabling direct access to existing C code and libraries. C's standard library is part of standard D.
C++'s ABI is not supported, although D can access C++ code that is written to the C ABI, and can access C++ COM (Component Object Model) code.
Current D implementations compile directly into native code for efficient execution.
D is still under development, so changes to the language are made regularly. Some of these could break D programs written for older versions of the language and compiler. The official compiler by Walter Bright defines the language itself, and it is currently in the beta testing state.
Example
// D program that prints its command line arguments import std.stdio; void main(char[][] args) { foreach(int i, char[] a; args) writefln("args[%d] = '%s'", i, a); }
External links
- Digital Mars: D programming language (http://www.digitalmars.com/d/)
- D WinLib windows library from Codemoon (http://www.codemoon.com/dpage.php)
- Open Directory Project: D programming Language (http://www.dmoz.org/Computers/Programming/Languages/D/)
- DSource, an open source community for the D Programming Language. (http://www.dsource.org)
- Dprogramming.com, home of the DFL windowing library. (http://www.dprogramming.com)
- Wiki4D, "the wiki for the d programming language" (http://www.prowiki.org/wiki4d/wiki.cgi?FrontPage)
- The Programming Language Shootout (http://shootout.alioth.debian.org/great/benchmark.php?test=all&lang=dlang&sort=fullcpu,)es:Lenguaje de programación D
fr:D (langage) ja:D言語 nl:Programmeertaal D pt:Linguagem D sv:D (programspråk)