The "D" Programming Language
From ArchWiki
Contents |
Introduction
The D programming language, also known simply as D, is an object-oriented, imperative, multi-paradigm system programming language by Walter Bright of Digital Mars. It originated as a re-engineering of C++, but even though it is predominantly influenced by that language, it is not a variant of it. D has redesigned some C++ features and has been influenced by concepts used in other programming languages, such as Java, C#, and Eiffel.
From Wikipedia.
Installation
To program in D you will need two things - a D compiler and a library. The official compiler is called DMD and is available from Arch's community repo:
# pacman -S dmd
You now have to choose the library you want to use, Phobos or Tango. If you are having trouble deciding which library to choose, have look at a comparison between the two.
Phobos
Phobos is the standard D library. It is available from Arch's community repo:
# pacman -S libphobos
Tango
The D community, after being unhappy about several aspects of the standard D library, wrote their own library called Tango. Tango can be installed from [community]:
# pacman -S libtango
Though at the time of writing, the current release of Tango has a bug making the math modules unusable. It is therefore recommended to install Tango from SVN. The package libtango-svn available from the AUR.
Testing the installation
To make sure that everything is installed and set up correctly, a simple Hello World program should suffice.
For Phobos:
import std.stdio; int main(char[][] args) { writefln("Hello World!"); return 0; }
For Tango:
import tango.io.Stdout; int main(char[][] args) { Stdout("Hello World!").newline(); return 0; }
Paste the code into a file, name it hello.d, and run
$ dmd hello.d
in the same directory as the file. You should then be able to execute the program with:
$ ./hello
Useful libraries, bindings, etc.
- QtD - Qt bindings for D
- GtkD - An object oriented GTK+ wrapper for D
- Derelict - Bindings for multimedia libraries, focused toward game development
- Bindings - A project that houses a lot of bindings to different C libraries
- Descent - An Eclipse plugin for programming in D
Links
- Digital Mars - The official home of D
- dsource - An open source D community, hosts several open source projects
- Planet D - A collection of blogs about D