D_programming_language D_programming_language

D programming language - Definition and Overview

There have been several programming languages called D during the history of computing. The one discussed in this article is that created by Walter Bright. The one called 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.

D uses garbage collection, but also allows the programmer to request that specific objects be finalized immediately when they go out of scope.

D also includes an interface to C's standard library: routines and libraries written in C can be called from D, although there is no interface with C++.

D is intended to be compiled directly into native code for efficient execution.

D is still under development, and 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 in continuous beta testing state.

Example

// D program that prints its command line arguments
import std.stdio;
int main(char[][] args) {
   foreach (int i, char[] arg; args)
      writefln("args[", i, "] = '", arg, "'");
   return 0;
}

External links


Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.