D (език за програмиране)
от Уикипедия, свободната енциклопедия
ВНИМАНИЕ: Тази статия се нуждае от частичен или цялостен превод. Ако имате познания по използвания език, не се колебайте! Благодарим Ви, че помагате на Уикипедия! |
D е обектно оринтиран, imperative systems език за програмиране създаден от Walter Bright of Digital Mars като наследник на C++. Няко й предложения са наследени от C++ включващи Java и C#.
D прибавя съвремени своиства като проект по договор, участък за тестване, точни модели, автоматично управление на паметта (garbage collection), първи клас масиви, closures (анонимни функции), и (reengineered template syntax). D запазва способноста на C++ за работа на ниско ниво , и добавя към тях подръжка на цялостен за inline асемблер. C++ множественото наследяжане се замества от наследяван с интерфейс и смесване. Декларациитте, оператори(statement) и изрази синтаксис отговарят на тези от C++.
The inline assembler typifies 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 the 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 even for the 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. [edit]
Example program
// D program that prints its command line arguments import std.stdio; int main(char[][] args) {
foreach(int i, char[] a; args) writefln("args[%d] = '%s'", i, a); return 0;
}
[edit]
[редактиране] External links
- Digital Mars: D programming language
- D WinLib windows library from Codemoon
- Open Directory Project: D programming Language
- DSource, an open source community for the D Programming Language.
- Dprogramming.com, home of the DFL windowing library.
- Wiki4D, "the wiki for the d programming language"
- The Programming Language Shootout