Change Log: 2.088.0
Download D nightlies
To be released
This changelog has been automatically generated from all commits in master since the last release.
- The full-text messages are assembled from the changelog/ directories of the respective repositories: dmd, druntime, phobos, tools, dlang.org, installer, and dub.
- See the DLang-Bot documentation for details on referencing Bugzilla. The DAutoTest PR preview doesn't include the Bugzilla changelog.
- The pending changelog can be generated locally by setting up dlang.org and running the pending_changelog target:
make -f posix.mak pending_changelog
Compiler changes
- A new syntax is available to declare an alias to a function type
- Add Markdown-inspired features to Ddoc
- scope as a type constraint on class declarations is deprecated.
- Usage of this and super as types is obsolete
- Turn deprecation into error for some invalid integer literals.
- fix Issue 16002 - Add is(sym == module) and is(sym == package)
- Local templates can now receive local symbols.
- Windows: The mingw based runtime and platform import libraries can now be selected explicitly
- Floating point types now use a quiet nan as the .init value
- Class allocators and deallocators are now obsolete
- The deprecation phase for access checks is finished
- Initialization of immutable global data from static this is deprecated
- Struct constructors with all-default parameter will now error
- Template alias parameters now match basic types as a conversion.
- 32 Bit Linux now uses XMM registers for float and double rather than the x87.
Runtime changes
Library changes
Dub changes
List of all upcoming bug fixes and enhancements in D 2.088.0.
Compiler changes
- A new syntax is available to declare an alias to a function type
It's now possible to declare an alias to a function type using the alias syntax based on the assignment operator. The declaration consists of the return type, followed by parameters and ends with optional (member) function attributes. See the AliasDeclarationY rule for more details.
Example:
alias int OldStyleFunAlias(string); alias NewStyleFunAlias = int(string); int fun(string p){return 0;} static assert(is(typeof(fun) == NewStyleFunAlias));
Note that an advantage compared to the old syntax is that the new allows a shortcut to function template types:
alias SetterProto(T) = void(T t); alias GetterProto(T) = T() const;
- Add Markdown-inspired features to Ddoc
With the -preview=markdown flag to dmd, Ddoc now supports Markdown features like headings, emphasized text, links and more. The full list of features is described in the Ddoc documentation page.
Use the -transition=vmarkdown flag together with the -preview=markdown flag to log all instances of Markdown features as they're processed in your documentation.
- scope as a type constraint on class declarations is deprecated.
scope as a type constraint on class declarations has been deprecated for quite some time. However, starting with this release, the compiler will emit a deprecation warning if used.
scope class C { } // Deprecation: `scope` as a type constraint is deprecated. Use `scope` at the usage site.
Note that this does not apply to structs. Deprecation of scope as a type constraint on structs is still awaiting a decision.
- Usage of this and super as types is obsolete
Prior to this release, this and super could be used as both data or types depending on the context, but was deprecated about a year ago. Starting with this release using this or super as a type will result in a compiler error.
class C { shared(this) x; // Error: Using `this` as a type is obsolete. Use `typeof(this)` instead } class D : C { shared(super) a; // Error: Using `super` as a type is obsolete. Use `typeof(super)` instead super b; // Error: Using `super` as a type is obsolete. Use `typeof(super)` instead }
Use typeof(super) or typeof(this) instead.
class C { shared(typeof(this)) x; } class D : C { shared(typeof(super)) a; typeof(super) b; }
- Turn deprecation into error for some invalid integer literals.
With this release DMD will issue an error when some invalid integer literals like 0b or 0x are used. Example:
auto a = 0b; // Error: `0b` isn't a valid integer literal, use `0b0` instead auto a = 0x; // Error: `0x` isn't a valid integer literal, use `0x0` instead
- fix Issue 16002 - Add is(sym == module) and is(sym == package)
This enhancement adds two new forms of the is(), expression, which determine whether a given symbol represents a module or package.
It also adds __traits(isModule, sym) and __traits(isPackage, sym), which do the same thing.
- Local templates can now receive local symbols.
With this release local and member templates can be instantiated with local symbols.
struct S { private int _m; void exec(alias fun)() { fun(_m); } } unittest { int localVar; void set(int i) { localVar = i; } auto obj = S(10); obj.exec!set(); assert(localVar == 10); }
This was a long-standing limitation that disturbed the metaprograming experience.
See issue 5710.
- Windows: The mingw based runtime and platform import libraries can now be selected explicitly
When specifying -mscrtlib=msvcrt100 explicitly on the command line to dmd, detection of a Visual Studio installation is skipped and the redistributable VC2010 dynamic runtime library and mingw based platform import libraries will be used unconditionally. The LLD linker (provided by the LLVM project) will be invoked instead of the Microsoft linker.
- Floating point types now use a quiet nan as the .init value
Prior to this release, float.init, double.init and real.init used a signalling nan. They now use a quiet nan, which is the same as the corresponding .nan value.
Old behaviour:
double a = double.init, b = double.nan; writefln("%x",*cast(ulong*)&a); // 7ff4000000000000 writefln("%x",*cast(ulong*)&b); // 7ff8000000000000
New behaviour:
double a = double.init, b = double.nan; writefln("%x",*cast(ulong*)&a); // 7ff8000000000000 writefln("%x",*cast(ulong*)&b); // 7ff8000000000000
- Class allocators and deallocators are now obsolete
Starting with this release any use of class allocators or deallocators will result in a compilation error.
See the deprecated features page for more information.
- The deprecation phase for access checks is finished
The -transition=import and -transition=checkimports switches no longer have an effect and are now deprecated. Symbols that are not visible in a particular scope will no longer be found by the compiler.
- Initialization of immutable global data from static this is deprecated
Prior to this release, the following code was possible:
module foo; immutable int bar; static this() { bar = 42; }
However, module constructors (static this) run each time a thread is spawned, and immutable data is implicitly shared, which led to immutable value being overriden every time a new thread was spawned. The simple fix for this is to use shared static this over static this, as the former is only run once per process.
- Struct constructors with all-default parameter will now error
Since 2.070.0, the following code has been giving deprecations:
struct Oops { this (int universe = 42) {} }
It will now error out.
- Template alias parameters now match basic types as a conversion.
With this release, templates with alias parameters can be instantiated with basic types, such as int or void function().
template Example(alias A) { alias Example = A[]; } alias IntArray = Example!int; template MatchType(T) { enum MatchType = "type"; } template MatchType(alias A) { enum MatchType = "alias"; } // alias matches, but type matches take priority. static assert (MatchType!int == "type");
Templates with alias parameters already matched named types, lambdas, and even value literals. Templates with variadic parameters already matched basic types. This led to strange replacements for alias such as template Template(T...) if (T.length == 1). Those replacements are no longer necessary.
As a consequence, in some cases templates will match that did not used to. For instance, a template may have falsely relied on alias parameters being "something callable" vs. type parameters being "the type of something callable", such as
void fun(T...)(T callable) { ... } void fun(alias A)() { ... }
Such overloads may now need to explicitly check whether A is callable in the second case:
void fun(alias A)() if (__traits(compiles, A())) { ... } // shorter, but may miss cases like structs with a static opCall void fun(alias A)() if (!isType!A) { ... }
- 32 Bit Linux now uses XMM registers for float and double rather than the x87.
This should substantially speed up routine float and double processing. SIMD vector operations, however, are still not support on 32 bit Linux code because of issues with 16 byte stack alignment.
This means that generated code will no longer work on older x86 processors that do not have XMM registers. If this is an issue, please file a bug report.
Runtime changes
- Convert FreeBSD's sys/ttycom.h into core.sys.posix.sys.ttycom
In FreeBSD, as in OSX, the tty part of ioctl is defined in sys/ttycom.h which is included by sys/ioctl.h. In druntime, there were OSX part of definitions in ttycom.d, but there were no FreeBSD equivalent. This change implements FreeBSD part of ttycom.d and ioccom.d, and public import core.sys.posix.sys.ttycom in ioctl.d. The OSX users and FreeBSD users can now use full ioctls related to tty by importing core.sys.posix.sys.ioctl, like including sys/ioctl.h in C language. (For example, TIOCGWINSZ ioctl was not provided in FreeBSD.) Since there are only version(OSX) and version(FreeBSD) part in ttycom.d, public import'ing core.sys.posix.sys.ttycom from ioctl.d will make no harm to other platforms.
- GC now marks the heap with multiple threads
The garbage collector now uses available CPU cores to mark the heap faster. This reduces pause times for a collection considerably.
By default, the GC uses all available logical cores of your CPU. This might affect your application if it has threads that are not suspended during the mark phase of the collection. You can configure the number of additional threads used for marking by DRT option parallel to the GC configuration, e.g. by passing --DRT-gcopt=parallel:2 on the command line. A value of 0 disables parallel marking completely.
As usual, you can also embed the configuration into the application by redefining rt_options, e.g.
extern(C) __gshared string[] rt_options = [ "gcopt=parallel:0" ];
- Add the clone and unshare functions to core.sys.linux.sched
clone(2) and unshare(2) are Linux-specific system calls. Bindings have been added to the corresponding D module, as well as the CLONE_* constants that are used as flags to these functions.
Library changes
- Added a table of control characters in ASCII table
There is a new enumerated type std.ascii.ControlChar. It has values for every control character in ASCII table and has a base type of char, allowing for alternative markup of strings with control characters:
import std.ascii, std.conv; with (ControlChar) assert(text("Phobos", us, "Deimos", us, "Tango", rs) == "Phobos\x1FDeimos\x1FTango\x1E");
- Count processors via sched_getaffinity on Linux
On GNU/Linux usable number of processors may be restricted if a process runs in containers. In case it's better to use sched_getaffinity(2).
import std.parallelism; writeln(totalCPUs); // 4 writeln(totalCPUs); // 1: runs on `taskset -c 0`
- Add overload std.algorithm.sorting.schwartzSort!(alias transform, SwapStrategy ss, R)
std.algorithm.sorting.schwartzSort now has an overloaded version that can be used to provide a SwapStrategy without also explicitly specifying the predicate to sort by.
auto s1 = a.schwartzSort!(abs, SwapStrategy.stable); // The old syntax still works. auto s2 = a.schwartzSort!(abs, "a < b", SwapStrategy.stable);
- Phobos is now compiled with -preview=dip1000
Phobos and Druntime are now compiled with -preview=dip1000.
This is a major milestone in the transition to DIP1000. Hence, end users can now start using -preview=dip1000 in their own code bases.
As always, any encountered issue should be reported to the issue tracker.
Dub changes
- Builds dynamicLibrary targets as dynamic libraries instead of static libraries.
Dub will no longer build dynamicLibrary targetType's as staticLibrary.
Except for x86_omf. This has been disabled due to numerous issues that will lead this to not doing what is expected of it.
No compiler or linker flags have been added at this time, you will need to specify the relevant flag to get the compiler to link dynamically against Phobos.
- The $DUB_BUILD_PATH variable was added
The $DUB_BUILD_PATH variable is now defined inside the postBuildCommands section. It contains the absolute path in which the package was built, and can be used to copy by-products of the build process to their intended locations.
For example, if an executable exports symbols, you will want to make the resulting import library and symbols export file available somewhere. That can be done with a dub.json section like this:
"postBuildCommands-windows": [ "copy /y $DUB_BUILD_PATH\\$DUB_TARGET_NAME.lib $PACKAGE_DIR\\lib" "copy /y $DUB_BUILD_PATH\\$DUB_TARGET_NAME.exp $PACKAGE_DIR\\lib" ],
- Command environment variable substitution changed
Now users can use the documented predefined variables inside custom command directives without the need for a wrapper shell script.
Before this would have failed: ```json "preBuildCommands": ["$DC -run foo.d"] ``` unless DC was defined as environment variable outside DUB.
It was before possible to run a script that used the $DC environment variable or on POSIX escape the $ with $$DC to make the shell substitute the variable. These workarounds are no longer needed now.
API change: none of the different command directives are no longer substituted with the process environment variables. You now access the raw commands as provided by the user in the recipe. dub describe has been adjusted and now also processes the predefined environment variables as well as the process environment variables.
List of all bug fixes and enhancements in D 2.088.0:
DMD Compiler regressions
- Bugzilla 19295: ICE when taking address of member function passed as template parameter
- Bugzilla 20011: [REG] modification of member of a manifest constant that's also a struct is allowed
- Bugzilla 20021: static if doesn't evaluate opCast(T : bool)
- Bugzilla 20022: POSIX: extern(C++, namespace) does not apply namespace to enum
- Bugzilla 20056: DMD Segfault in 2.087
- Bugzilla 20057: compiler hang on conflicting local and imported template
- Bugzilla 20063: compiler segfaults on passing templates expression to lazy val
- Bugzilla 20067: [REG2.086] foreach no longer works on range with alias front
- Bugzilla 20136: opEquals not recognized for AA key
DMD Compiler bugs
- Bugzilla 930: Templates inside templates used as mixins
- Bugzilla 1142: .stringof performs semantic analysis
- Bugzilla 7443: Better diagnostic on wrongly written static constructor
- Bugzilla 9884: Refused initialization of const array in the module static this()
- Bugzilla 11856: DMD segfault with circular template constraints
- Bugzilla 15478: cases of missed CTFE evaluation when defining arrays dimensions
- Bugzilla 15795: bogus "conflicts with" error depending on order of declaration
- Bugzilla 15818: Multiple function declarations without definition cause ambiguity overloading error
- Bugzilla 17828: [ICE] Internal error: ddmd/backend/cgcs.c 352 - CTFE appending to an array on a struct from a template
- Bugzilla 17885: Unable to remove a tuple from associative array.
- Bugzilla 18719: Doubly-called constructor against member when using forwarding constructors
- Bugzilla 18729: dmd -run executes in different environment
- Bugzilla 19122: Postblits and destructors called on members of anonymous unions
- Bugzilla 19315: #line inside token string affect outside code
- Bugzilla 19534: Wrong error message "only one index allowed to index int"
- Bugzilla 19646: Initialization of globals not checked for @safe
- Bugzilla 19708: Can't use __traits(getAttributes, ...)[...] as a type
- Bugzilla 19754: cast() sometimes yields lvalue, sometimes yields rvalue
- Bugzilla 19919: Incorrect initialization of union when first member isn't marked = void
- Bugzilla 19925: static opDispatch not considered in WithStatement
- Bugzilla 19931: Missing error message when defining postblit, rvalue constructor and copy constructor
- Bugzilla 19950: access violation at compile time, possibly via template constraint and alias interaction
- Bugzilla 19968: @safe code can create invalid bools resulting in memory corruption
- Bugzilla 20001: Error: a struct is not a valid initializer for a _error_
- Bugzilla 20019: Symbol not found: _dyld_enumerate_tlv_storage on macOS 10.15
- Bugzilla 20025: alias this combined with a copy constructor seems to lead to undefined behaviour.
- Bugzilla 20033: alias this does not support deprecated attribute
- Bugzilla 20035: [ICE] Segmentation fault in ExpressionPrettyPrintVisitor::visit(IntegerExp*) at dmd/hdrgen.d:1775
- Bugzilla 20039: ICE from double template instantiation with getMember of overload of class and template function
- Bugzilla 20042: __vector CTFE crashes the compiler
- Bugzilla 20044: Compiler crash when using an opaque struct as template parameter
- Bugzilla 20045: bogus error: "integer constant expression expected instead of (uint).sizeof"
- Bugzilla 20047: call of static nested function ignores purity
- Bugzilla 20048: [Windows] Program segfaults when running tests
- Bugzilla 20050: pure function should be able to return function pointer to impure static nested function
- Bugzilla 20051: ICE in func literal used in __traits(compiles)
- Bugzilla 20052: SIMD 32 bytes causes obscure segfault
- Bugzilla 20072: [2.087.0] Mixin templates: no property somevar for type some.Type, did you mean some.Type.__anonymous.somevar?
- Bugzilla 20073: Wrong implicit conversion for return type
- Bugzilla 20074: header file generation doesn't include attributes with CallExp
- Bugzilla 20096: error message 'cannot goto into try block' is followed by seg fault
- Bugzilla 20100: Segfault with checkaction=context on struct comparison
- Bugzilla 20108: -dip1000 defeated by auto
- Bugzilla 20113: Cannot find source code for runtime library file 'object.d' when the path contains '~'
DMD Compiler enhancements
- Bugzilla 1252: Inline assembler could support BasicType properties
- Bugzilla 18665: Deprecate Undocumented Operator Overloads
- Bugzilla 19917: unions should require that all members are = void initialised
- Bugzilla 19969: Unhelpful error when attempting (incorrectly) to append to a string
- Bugzilla 20000: Casting to interfaces disallowed in @safe code
- Bugzilla 20024: "No property x for type Y" error not as helpful as it should be
- Bugzilla 20037: Imports in module info should be deduplicated
- Bugzilla 20053: add mixin types
- Bugzilla 20059: mismatched function return type inference should give location of inferred type
- Bugzilla 20065: Empty AliasSeq can't be used to form compiletime array literal
Phobos bugs
- Bugzilla 16132: std.variant.VariantN does not work with a class that inherits from a template instantiation
- Bugzilla 19696: ReplaceType replaces type with the type forwarding using alias this
- Bugzilla 19697: ReplaceType fails to compile for self-referential inheritance chains
- Bugzilla 19823: std.algorithm.iteration.filter's popFront doesn't always pop the first element like it's supposed to
- Bugzilla 19980: File.byLine skips first line in some cases when used inside map!()
- Bugzilla 19986: Can't assign large const T to std.Variant.VariantN
- Bugzilla 19987: std.variantN wastes space
- Bugzilla 20046: someAllocator.make!T doesn't compile if T is a shared value type
- Bugzilla 20064: format separator fails with leading zeros
- Bugzilla 20070: [2.087.0] std.conv.toImpl matches two functions when using static arrays as inout( T )
- Bugzilla 20097: SysTime cannot be used with std.concurrency.send
- Bugzilla 20129: AA require with File values gives "Error: return expression expected" in object.d
Phobos enhancements
- Bugzilla 16487: Add function to obtain the available disk space
- Bugzilla 19834: File exception for [std.file.copy] on windows shows the target file rather than the source file
- Bugzilla 19838: RefCounted fails to instantiate due to pureness of moveEmplace
- Bugzilla 19979: std.regex should return null instead of zero-length slice for non-matched captures
- Bugzilla 19983: Add fast path using slice assignment to std.internal.cstring.tempCString
- Bugzilla 19994: Can't nest self-referential Algebraic types
- Bugzilla 20043: Tuple.rename doesn't work with const
- Bugzilla 20069: std.format digit grouping separator (aka thousands separator) needs to be revisited
- Bugzilla 20098: Improve result of printing std.regex compiled pattern
Druntime bugs
- Bugzilla 20026: retrying while pthread_cond_signal/pthread_cond_broadcast return EAGAIN
- Bugzilla 20049: object.destroy doesn't propagate attributes
- Bugzilla 20066: Assertion on void[] does not compile with -checkaction=context
- Bugzilla 20088: void[] cast unusable in betterC due to new __ArrayCast template
Druntime enhancements
- Bugzilla 19976: Simplify std.internal.convert.toUbyte CTFE path for float and double
- Bugzilla 20104: core.atomic has no exchange function
- Bugzilla 20122: core.atomic.cas discards result on failure
dlang.org bugs
- Bugzilla 19402: specs for promotion rule of shift exp is wrong
- Bugzilla 19944: Some examples on std.file docs page raise FileException
Contributors to this release (66)
A huge thanks goes to all the awesome people who made this release possible.
- aG0aep6G
- Alexibu
- Andrei Alexandrescu
- Atila Neves
- Basile Burg
- Basile-z
- Bastiaan Veelo
- Boris Carvajal
- Brian Kessler
- Cameron Ross
- Charles McAnany
- Chloé Kekoa
- Dan Printzell
- David Gileadi
- dkorpel
- Dmitry Olshansky
- Dragos Carp
- Eduard Staniloiu
- Elias Batek
- Ernesto Castellotti
- Francesco Mecca
- godmyoh
- Greg V
- Harry T. Vennik
- Hiroki Noda
- Iain Buclaw
- Jacob Carlborg
- Jason Schroeder
- jercaianu
- John Colvin
- Jonathan Marler
- karita
- Kriyszig
- lenoil98
- Les De Ridder
- Manu Evans
- Marco de Wild
- Martin Kinkelin
- Martin Nowak
- Mathias Lang
- Mathis Beer
- Mike Franklin
- Márcio Martins
- Nathan Sashihara
- Nicholas Wilson
- Paul Backus
- Petar Kirov
- Quirin F. Schroll
- Radu Racariu
- Rainer Schuetze
- Razvan Nitu
- Robert burner Schadek
- Robert Schadek
- Sebastiaan Koppe
- Sebastian Wilzbach
- Shigeki Karita
- shove
- Stanislav Blinov
- Stefan Koch
- Timon Gehr
- TJesionowski
- Tomáš Chaloupka
- Viktor
- Vladimir Panteleev
- Walter Bright
- سليمان السهمي (Suleyman Sahmi)