Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
229 lines (194 sloc) 6.53 KB
$(D_S D Programming Language $(VER),
It seems to me that most of the $(SINGLEQUOTE new) programming languages
fall into one of two categories: Those from academia with radical
new paradigms and those from large corporations with a focus on RAD
and the web. Maybe it's time for a new language born out of
practical experience implementing compilers.
$(BLOCKQUOTE Segfault,
Great, just what I need.. another D in programming.
$(P The D book $(AMAZONLINK 1590599608, Learn to Tango with D)
by Kris Bell, Lars Ivar Igesund, Sean Kelly and Michael Parker is now out.
The second
$(LINK2, D Programming Language Conference)
will take place in Seattle at Amazon, Aug 4..6, 2008.
$(P The first
$(LINK2, D Programming Language Conference)
took place in Seattle at Amazon, Aug 23..24, 2007.)
D is a systems programming language.
Its focus is on combining the power and high performance of C and C++ with
the programmer productivity of modern languages like Ruby and Python.
Special attention is given to the needs of quality assurance, documentation,
management, portability and reliability.
$(P The D language is statically typed and compiles directly to machine code.
It's multiparadigm, supporting many programming styles:
imperative, object oriented, and metaprogramming. It's a member of the C
syntax family, and its appearance is very similar to that of C++.
Here's a quick list of $(LINK2 comparison.html, features).
$(P It is not governed by a corporate agenda or any overarching theory of
programming. The needs and contributions of the
$(LINK2 ../NewsGroup.html, D programming community) form the direction it
$(P There are two versions of the language:
$(LI $(LINK2, D version 1)
which is in maintenance mode.)
$(LI $(LINK2, D version 2)
which is recommended for new projects.)
$(P There are currently four implementations:
$(LI Digital Mars dmd for
Windows $(LINK2, 1.0)
$(LINK2, 2.0),
x86 Linux $(LINK2, 1.0)
$(LINK2, 2.0),
Mac OS X $(LINK2, 1.0)
$(LINK2, 2.0), and
x86 FreeBSD $(LINK2, 1.0)
$(LI LLVM D Compiler $(LINK2, ldc)
for D version 1.
$(LI Gnu D compiler $(LINK2, gdc)
for several platforms, including
$(LINK2, Windows) and
$(LINK2, Mac OS X)
for D versions 1.030 and 2.014.
$(LI Gnu D compiler $(LINK2, gdc).
$(LI $(LINK2, D.NET compiler)
alpha for .NET for D version 2.)
$(P A large and growing collection of D source code and projects
are at $(LINK2, dsource).
More links to innumerable D wikis, libraries, tools, media articles,
etc. are at $(LINK2, dlinks).
This document is available as a
$(LINK2, pdf),
as well as in
$(LINK2, Japanese)
$(LINK2, Portugese)
A German book
$(LINK2, Programming in D: Introduction to the new Programming Language)
is available, as well as
a Japanese book
$(LINK2, D Language Perfect Guide),
and a Turkish book
$(LINK2, D Programlama Dili Dersleri).
$(COMMENT: Japanese by Kazuhiro Inaba, Portugese by Christian Hartung)
$(P This is an example D program illustrating some of the capabilities:)
#!/usr/bin/dmd -run
/* sh style script syntax is supported */
/* Hello World in D
To compile:
dmd hello.d
or to optimize:
dmd -O -inline -release hello.d
import std.stdio;
void main(string[] args)
$(V1 writefln("Hello World, Reloaded");)$(V2 writeln("Hello World, Reloaded");)
// auto type inference and built-in foreach
foreach (argc, argv; args)
// Object Oriented Programming
auto cl = new CmdLin(argc, argv);
// Improved typesafe printf
writeln(cl.argnum, cl.suffix, " arg: ", cl.argv);
// Automatic or explicit memory management
delete cl;
// Nested structs and classes
struct specs
// all members automatically initialized
int count, allocated;
// Nested functions can refer to outer
// variables like args
specs argspecs()
specs* s = new specs;
// no need for '->'
s.count = args.length; // get length of array with .length
s.allocated = typeof(args).sizeof; // built-in native type properties
foreach (argv; args)
s.allocated += argv.length * typeof(argv[0]).sizeof;
return *s;
// built-in string and common string operations
writefln("argc = %d, " ~ "allocated = %d",
argspecs().count, argspecs().allocated);
class CmdLin
private int _argc;
private string _argv;
this(int argc, string argv) // constructor
_argc = argc;
_argv = argv;
int argnum()
return _argc + 1;
string argv()
return _argv;
string suffix()
string suffix = "th";
switch (_argc)
case 0:
suffix = "st";
case 1:
suffix = "nd";
case 2:
suffix = "rd";
return suffix;
$(P $(B Notice:) We welcome feedback about the D compiler or language, but please be explicit about
any claims to intellectual property rights with a copyright or patent notice if you have such for
your contributions. We want D to remain open and free to use, and do not wish to be caught by
someone posting a patch to the compiler, and then later claim compensation for that work.)
Something went wrong with that request. Please try again.