D programming language
There have been several programming languages called D during the history of computing. (This needs elaboration.)
Currently, arguably, the most interesting one is that created by Walter Bright. This language aspires to take the positive features of C, C++ and a few other Algol syntax based programming languages, and to drop the negative features.
D drops archaic C++ features like the preprocessor and forward declarations. It adds modern features like design by contract, unit testing, true modules, automatic memory management (garbage collection), first class arrays, closuress, 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 microprocessor needed to run programs that interface directly with the underlying hardware, such as operating systems and device drivers.
Unlike Java, but like C++, D does allow the programmer to overload operators.
D also supports legacy programming through an interface to C's standard library: routines and libraries written in C can be easily called from D. The same is not true with C++, however. There are also many features to support version and platform checking while compiling programs, tasks that are often accomplished in an ad-hoc manner with C's pre-processor.
Example
// D program to print 'hello world' followed by its command line arguments
import std.stdio;
int main(char[][] args)
{
writefln("hello world");
foreach (int i, char[] arg; args)
writefln("args[", i, "] = '", arg, "'");
return 0;
}
External links