Difference between revisions of "D (programming language)"

From ArchWiki
Jump to: navigation, search
(Installation: is now in aur, updating)
({{out of date}} hasn't been updated to reflect the fact that there are now 2 versions of the language, etc. - I don't use D, so I can't really update it any more)
Line 1: Line 1:
 
[[Category: Development (English)]]
 
[[Category: Development (English)]]
 +
{{out of date}}
 
= Introduction =
 
= Introduction =
 
<blockquote>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.</blockquote>
 
<blockquote>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.</blockquote>

Revision as of 01:38, 30 September 2011

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:D (programming language)#)

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:D (programming language).

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 in the AUR.

Template:Package AUR is just the compiler, and Template:Package AUR includes the standard library.

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