D Programming Language
Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

# D 2.0 Specific Features

D 2.0 has many substantial language and library enhancements compared with D 1.0. This list does not include bug fixes or changes that were also made to D 1.0. See the D1 to D2 Migration Guide for help in converting source code.

## Core Language Changes

- opAssign can no longer be overloaded for class objects.
- Added pure keyword.
- Extended enums to allow declaration of manifest constants.
- Added const/immutable structs, classes and interfaces.
- Added const and immutable to IsExpressions.
- Added typeof(return) type specifier.
- Added overloadable unary * operation as opStar().
- Full closure support added.
- Transformed all of string, wstring, and dstring into immutable definitions
.
- Added Overload Sets for functions and templates.
- std.math.sin, cos, tan are now evaluated at compile time if the argument is a constant.
- Added C++ interface for ‘plugins’.
- Changed result type of IsExpression from int to bool.
- Added optional TemplateParameterList to IsExpression.
- Added warning when override is omitted.
- Added new syntax for string literals (delimited, heredoc, D tokens)
- Added __EOF__ token
- Added D_Version2 predefined identifier to indicate this is a D version 2.0 compiler
- Added .idup property for arrays to create immutable copies.
- Added transitive const and immutable.
- in parameter storage class now means scope const.
- class and struct invariant declarations now must have a ().
- Added isSame and compiles to __traits.
- Added ForeachRangeStatement
.

## Phobos Library Changes

- std.algorithm: new module
- std.bitarray: scheduled for deprecation
- std.bitmanip: new module with the content of std.bitarray plus the bitfields, FloatRep, and DoubleRep templates
- std.contracts: new module
- std.conv: Added parse and assumeUnique. Made conv_error a template parameterized on the types being converted. Massive additions.
- std.file: added dirEntries.
- std.format: Added raw ('r') format specifier for writef*.
- std.functional: new module
- std.getopt: new module.
- std.hiddenfunc: new module
- std.math: Made nextafter visible for all floating types. Added approxEqual template.
- std.numeric: new module
- std.path: Added rel2abs (Linux version only). Added the basename and dirname functions (which alias the less gainful names getBaseName and getDirectoryName)
- std.process: Made getpid visible in Linux builds
- std.stdio: Added writeln() and write(), writef() can now only accept a format as its first argument. Added optional terminator to readln. Added functions fopen, popen, lines and chunks.
- std.string: Added munch function and added function chompPrefix.
- std.random: Major addition of engines and distributions.
- std.traits: new module
- std.typecons: new module
- std.variant: new module.
- Incorporated many of the Tango GC structural differences (much more to go still).
- Overhaul phobos linux.mak and add documentation build logic
- Moved next member from Object.Error to Object.Exception
- Renamed linux library from libphobos.a to libphobos2.a

Forums | Comments | Search | Downloads | Home
Copyright © 1999-2014 by Digital Mars ®, All Rights Reserved | Page generated by Ddoc on Wed Oct 15 12:03:59 2014