Difference between revisions of "D"

From RogueBasin
Jump to navigation Jump to search
(→‎Introduction: Need to cite that Walter Bright (Digital Mars) was the creator of the first native C++ compiler.)
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==


D is static, compiled language influenced by [[Cpp|C++]]. It was created by Walter Bright, author of the first C++ compiler to compile directly to machine code<sup>[''citation needed'']</sup>.
D is static, compiled language influenced by [[Cpp|C++]]. It was created by Walter Bright, author of the first C++ compiler to compile directly to machine code without using C as an intermediate language.<sup>[''citation needed'']</sup>


D has an imperative core, but is a multi-paradigm language that includes support for object-orientated, functional, and generic programming.
D has an imperative core, but is a multi-paradigm language that includes support for object-orientated, functional, and generic programming.
Line 7: Line 7:
== Advantages ==
== Advantages ==


* Fast language, with performance comparable to C++ while still being garbage collected by default.
* Compiles natively with performance comparable to C++ while still being garbage collected by default.
* Interfaces well with [[C]] libraries, without writing boilerplate or using a foreign function interface, though cannot import headers unmodified - see http://www.digitalmars.com/d/2.0/htomodule.html . Although [[C++]] interfacing is more limited, it is available (see D Programming Language Specification: Chapter 33).
* Interfaces well with [[C]] libraries, without writing boilerplate or using a foreign function interface and can import headers unmodified - see https://github.com/atilaneves/dpp. Although C++ interfacing is more limited, it is available (see D Programming Language Specification: Chapter 33).
* Has a modern module system, no need to write header files or deal with a preprocessor.
* Has a modern module system, no need to write header files or deal with a preprocessor.
* Syntax is familiar to C, C++, [[C_Sharp|C#]], [[Java]] etc programmers.
* Syntax is familiar to C, C++, [[C_Sharp|C#]], [[Java]] etc programmers.
* Supports the functional programming paradigm better than other C-like languages, with features such as closures, delegates, transitive immutability, higher order functions, anonymous functions, and the ability to write compiler enforced pure functions.
* Supports the functional programming paradigm better than other C-like languages, with features such as closures, delegates, transitive immutability, higher order functions, anonymous functions, and the ability to write compiler enforced pure functions.
* D2 tries to do the template metaprogramming thing, which C++ supports without really meaning to, in a way that's actually sane to use.
* Supports the template metaprogramming thing, which C++ supports without really meaning to, in a way that's actually sane to use.
* DMD builds code incredibly fast, making compile-edit-run cycles comparable to dynamic languages. Build automation tools like make, etc. are used in the same way as they are used in C/C++ projects.
* DMD builds code incredibly fast, making compile-edit-run cycles comparable to dynamic languages. Build automation tools like make, etc. can be used in the same way as they are used in C/C++ projects.
* Knowledgeable, helpful community (including the D.learn forum for asking questions).
* Knowledgeable, helpful community (including the D.learn forum for asking questions).
* Unicode native - call the &#9731;.melt() function, or instantiate a &#128161;!T; the basic string type is UTF-8.
* Unicode native - call the &#9731;.melt() function, or instantiate a &#128161;!T; the basic string type is UTF-8.
Line 21: Line 21:


* There aren't as many libraries available if you want pure D implementations.
* There aren't as many libraries available if you want pure D implementations.
* The language is mostly stable, but still has breaking changes on rare occasion.
* The language is mostly stable, but still has breaking changes on rare occasions (although these are preceded by deprecation warnings)
* Documentation sometimes abstruse or lacking examples; paucity of beginner learning resources.
* Documentation sometimes abstruse or lacking examples; paucity of beginner learning resources.


Line 27: Line 27:


* DMD (reference compiler; bleeding edge feature support) - http://dlang.org/download.html
* DMD (reference compiler; bleeding edge feature support) - http://dlang.org/download.html
* GDC (GCC backend; targets the most platforms) - http://gdcproject.org/
* GDC (GCC backend; strong optimization; targets the most platforms, but generally a bit behind) - http://gdcproject.org/
* LDC (LLVM backend; usually builds the fastest binaries) - http://wiki.dlang.org/LDC
* LDC (LLVM backend; also strong optimizations, targets almost as many platforms as GDC but generally implements a bit newer version of the language) - http://wiki.dlang.org/LDC
* Dub (Package manager and build tool) - http://code.dlang.org/download
* Dub (Package manager and build tool) - http://code.dlang.org/download
* IDEs and IDE plugins - http://wiki.dlang.org/IDEs
* IDEs and IDE plugins - http://wiki.dlang.org/IDEs
Line 36: Line 36:
== Roguelike Libraries ==
== Roguelike Libraries ==


* Bindings for [[libtcod]] - http://code.google.com/p/libtcod-d/
* Bindings for [[libtcod]] - https://github.com/jaydg/libtcod-d
* Interface to ncurses - https://github.com/D-Programming-Deimos/ncurses
* Interface to [[Ncurses]] - https://github.com/D-Programming-Deimos/ncurses
* Bindings to [[BearLibTerminal]] - https://github.com/Elronnd/bearlibterminal-dlang
* Adam Ruppe's arsd collection (simpledisplay, terminal, eventloop, database, script, etc.) - https://github.com/adamdruppe/arsd
* Adam Ruppe's arsd collection (simpledisplay, terminal, eventloop, database, script, etc.) - https://github.com/adamdruppe/arsd
* Terminal ANSI colour lib - http://code.dlang.org/packages/rainbow
* Terminal ANSI colour lib - http://code.dlang.org/packages/rainbow
* Parser for Tiled maps - http://code.dlang.org/packages/dtiled
* Parser for Tiled maps - http://code.dlang.org/packages/dtiled
* ArmageddonEngine, D2 library for games, network applications etc. (lots of utility code) - https://github.com/CyberShadow/ae
* ArmageddonEngine, D library for games, network applications etc. (lots of utility code) - https://github.com/CyberShadow/ae
* Console rendering with layers for games - http://code.dlang.org/packages/clayers
* scone - cross-platform terminal application library - http://code.dlang.org/packages/scone
* [[NotEye|Necklace of the Eye]] includes sample in D.


== D Roguelikes ==
== D Roguelikes ==


* {{7DRL}} [[Infection]]
* {{7DRL}} [[Infection]]
* {{Alpha}} [[Arcan Myth RL]]
* {{Alpha}} [[Tetraworld]]


== Links ==
== Links ==

Latest revision as of 20:54, 6 November 2020

Introduction

D is static, compiled language influenced by C++. It was created by Walter Bright, author of the first C++ compiler to compile directly to machine code without using C as an intermediate language.[citation needed]

D has an imperative core, but is a multi-paradigm language that includes support for object-orientated, functional, and generic programming.

Advantages

  • Compiles natively with performance comparable to C++ while still being garbage collected by default.
  • Interfaces well with C libraries, without writing boilerplate or using a foreign function interface and can import headers unmodified - see https://github.com/atilaneves/dpp. Although C++ interfacing is more limited, it is available (see D Programming Language Specification: Chapter 33).
  • Has a modern module system, no need to write header files or deal with a preprocessor.
  • Syntax is familiar to C, C++, C#, Java etc programmers.
  • Supports the functional programming paradigm better than other C-like languages, with features such as closures, delegates, transitive immutability, higher order functions, anonymous functions, and the ability to write compiler enforced pure functions.
  • Supports the template metaprogramming thing, which C++ supports without really meaning to, in a way that's actually sane to use.
  • DMD builds code incredibly fast, making compile-edit-run cycles comparable to dynamic languages. Build automation tools like make, etc. can be used in the same way as they are used in C/C++ projects.
  • Knowledgeable, helpful community (including the D.learn forum for asking questions).
  • Unicode native - call the ☃.melt() function, or instantiate a 💡!T; the basic string type is UTF-8.
  • A package registry (http://code.dlang.org/)

Disadvantages

  • There aren't as many libraries available if you want pure D implementations.
  • The language is mostly stable, but still has breaking changes on rare occasions (although these are preceded by deprecation warnings)
  • Documentation sometimes abstruse or lacking examples; paucity of beginner learning resources.

Compilers/Tooling

Roguelike Libraries

D Roguelikes

Links