D 2.0 Specific Features - D Programming Language 2.0 - Digital Mars

D Programming Language 2.0

- Wiki
- Search
- Downloads
- Home

Last update Tue Jun 30 11:31:51 2009

# D 2.0 Enhancements from D 1.0

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.

## 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/invariant structs, classes and interfaces.
- Added `const` and `invariant` 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 invariant 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 invariant copies.
- Added transitive const and invariant.
- `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

Copyright © 1999-2009 by Digital Mars ®, All Rights Reserved | Page generated by Ddoc. | Comments