Difference between revisions of "D"

From ArchWiki
Jump to navigation Jump to search
(added spanish language)
m (no more plus in gtk)
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:
 
{{Expansion|Add {{Pkg|ldc}} based on [[LLVM]].}}
 
{{Expansion|Add {{Pkg|ldc}} based on [[LLVM]].}}
  
To program in D you will need two things - a D compiler and a library. Easiest way to get started fast is to install {{Grp|dlang-dmd}} package group. It will provide the official compiler ({{Pkg|dmd}}), the standard lbrary {{Pkg|libphobos}} and {{Pkg|dtools}}, a collection of small development tools.
+
To program in D you will need two things - a D compiler and a library. Easiest way to get started fast is to install {{Grp|dlang-dmd}} package group. It will provide the official compiler ({{Pkg|dmd}}), the standard library {{Pkg|libphobos}} and {{Pkg|dtools}}, a collection of small development tools.
  
 
== Testing the installation ==
 
== Testing the installation ==
Line 44: Line 44:
 
* [http://mono-d.alexanderbothe.com/ Mono-D] - [http://monodevelop.com/ MonoDevelop] addin for programming in D
 
* [http://mono-d.alexanderbothe.com/ Mono-D] - [http://monodevelop.com/ MonoDevelop] addin for programming in D
 
* [https://bitbucket.org/qtd/repo QtD] - Qt bindings for D
 
* [https://bitbucket.org/qtd/repo QtD] - Qt bindings for D
* [http://gtkd.org/ GtkD] - An object oriented GTK+ wrapper for D
+
* [http://gtkd.org/ GtkD] - An object oriented GTK wrapper for D
 
* [https://github.com/aldacron/Derelict3 Derelict] - Bindings for multimedia libraries, focused toward game development
 
* [https://github.com/aldacron/Derelict3 Derelict] - Bindings for multimedia libraries, focused toward game development
 
* [https://github.com/D-Programming-Deimos Deimos] - A project that houses a lot of bindings to different C libraries
 
* [https://github.com/D-Programming-Deimos Deimos] - A project that houses a lot of bindings to different C libraries

Latest revision as of 17:04, 15 August 2019

From Wikipedia:D (programming language):

"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".

Installation

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Add ldc based on LLVM. (Discuss in Talk:D#)

To program in D you will need two things - a D compiler and a library. Easiest way to get started fast is to install dlang-dmd package group. It will provide the official compiler (dmd), the standard library libphobos and dtools, a collection of small development tools.

Testing the installation

To make sure that everything is installed and set up correctly, a simple Hello World program should suffice.

import std.stdio;

void main() {
   string yourName = "archer";
   writefln("Hello %s!", yourName);
}

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

You can also execute

$ dmd -run hello.d

which will simply compile and run without leaving any object files in the directory.

Considerations

There are however possible choices regarding the compiler you choose. The standard (reference one) is dmd, but gdc (GNU D Compiler) and ldc (LLVM D Compiler) are also popular. Those are also in [community].

As of April 2017 dmd's backend is now FOSS (Boost-licensed). All 3 compilers share same front-end code and thus have almost identical support for language features (assuming same front-end version).

Useful libraries and bindings

  • DDT - Eclipse plugin for project and code management in D
  • Mono-D - MonoDevelop addin for programming in D
  • QtD - Qt bindings for D
  • GtkD - An object oriented GTK wrapper for D
  • Derelict - Bindings for multimedia libraries, focused toward game development
  • Deimos - A project that houses a lot of bindings to different C libraries

See also