Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
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 a local clone.

Change Log: 2.088.0

previous version: 2.087.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


2.088.0 comes with 25 major changes and 93 fixed Bugzilla issues. A huge thanks goes to the 66 contributors who made 2.088.0 possible.

List of all upcoming bug fixes and enhancements in D 2.088.0.

Compiler changes

  1. 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;
    
  2. 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.

  3. 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.

  4. 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;
    }
    
  5. 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
    
  6. 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.

  7. 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.

  8. 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.

  9. 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
    
  10. 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.

  11. 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.

  12. 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.

  13. 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.

  14. 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) { ... }
    
  15. 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

  1. 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.

  2. 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" ];
    
  3. 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

  1. 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");
    
  2. 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`
    
  3. 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);
    
  4. 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

  1. 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.

  2. 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"
        ],
    
  3. 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

  1. Bugzilla 19295: ICE when taking address of member function passed as template parameter
  2. Bugzilla 20011: [REG] modification of member of a manifest constant that's also a struct is allowed
  3. Bugzilla 20021: static if doesn't evaluate opCast(T : bool)
  4. Bugzilla 20022: POSIX: extern(C++, namespace) does not apply namespace to enum
  5. Bugzilla 20056: DMD Segfault in 2.087
  6. Bugzilla 20057: compiler hang on conflicting local and imported template
  7. Bugzilla 20063: compiler segfaults on passing templates expression to lazy val
  8. Bugzilla 20067: [REG2.086] foreach no longer works on range with alias front
  9. Bugzilla 20136: opEquals not recognized for AA key

DMD Compiler bugs

  1. Bugzilla 930: Templates inside templates used as mixins
  2. Bugzilla 1142: .stringof performs semantic analysis
  3. Bugzilla 7443: Better diagnostic on wrongly written static constructor
  4. Bugzilla 9884: Refused initialization of const array in the module static this()
  5. Bugzilla 11856: DMD segfault with circular template constraints
  6. Bugzilla 15478: cases of missed CTFE evaluation when defining arrays dimensions
  7. Bugzilla 15795: bogus "conflicts with" error depending on order of declaration
  8. Bugzilla 15818: Multiple function declarations without definition cause ambiguity overloading error
  9. Bugzilla 17828: [ICE] Internal error: ddmd/backend/cgcs.c 352 - CTFE appending to an array on a struct from a template
  10. Bugzilla 17885: Unable to remove a tuple from associative array.
  11. Bugzilla 18719: Doubly-called constructor against member when using forwarding constructors
  12. Bugzilla 18729: dmd -run executes in different environment
  13. Bugzilla 19122: Postblits and destructors called on members of anonymous unions
  14. Bugzilla 19315: #line inside token string affect outside code
  15. Bugzilla 19534: Wrong error message "only one index allowed to index int"
  16. Bugzilla 19646: Initialization of globals not checked for @safe
  17. Bugzilla 19708: Can't use __traits(getAttributes, ...)[...] as a type
  18. Bugzilla 19754: cast() sometimes yields lvalue, sometimes yields rvalue
  19. Bugzilla 19919: Incorrect initialization of union when first member isn't marked = void
  20. Bugzilla 19925: static opDispatch not considered in WithStatement
  21. Bugzilla 19931: Missing error message when defining postblit, rvalue constructor and copy constructor
  22. Bugzilla 19950: access violation at compile time, possibly via template constraint and alias interaction
  23. Bugzilla 19968: @safe code can create invalid bools resulting in memory corruption
  24. Bugzilla 20001: Error: a struct is not a valid initializer for a _error_
  25. Bugzilla 20019: Symbol not found: _dyld_enumerate_tlv_storage on macOS 10.15
  26. Bugzilla 20025: alias this combined with a copy constructor seems to lead to undefined behaviour.
  27. Bugzilla 20033: alias this does not support deprecated attribute
  28. Bugzilla 20035: [ICE] Segmentation fault in ExpressionPrettyPrintVisitor::visit(IntegerExp*) at dmd/hdrgen.d:1775
  29. Bugzilla 20039: ICE from double template instantiation with getMember of overload of class and template function
  30. Bugzilla 20042: __vector CTFE crashes the compiler
  31. Bugzilla 20044: Compiler crash when using an opaque struct as template parameter
  32. Bugzilla 20045: bogus error: "integer constant expression expected instead of (uint).sizeof"
  33. Bugzilla 20047: call of static nested function ignores purity
  34. Bugzilla 20048: [Windows] Program segfaults when running tests
  35. Bugzilla 20050: pure function should be able to return function pointer to impure static nested function
  36. Bugzilla 20051: ICE in func literal used in __traits(compiles)
  37. Bugzilla 20052: SIMD 32 bytes causes obscure segfault
  38. Bugzilla 20072: [2.087.0] Mixin templates: no property somevar for type some.Type, did you mean some.Type.__anonymous.somevar?
  39. Bugzilla 20073: Wrong implicit conversion for return type
  40. Bugzilla 20074: header file generation doesn't include attributes with CallExp
  41. Bugzilla 20096: error message 'cannot goto into try block' is followed by seg fault
  42. Bugzilla 20100: Segfault with checkaction=context on struct comparison
  43. Bugzilla 20108: -dip1000 defeated by auto
  44. Bugzilla 20113: Cannot find source code for runtime library file 'object.d' when the path contains '~'

DMD Compiler enhancements

  1. Bugzilla 1252: Inline assembler could support BasicType properties
  2. Bugzilla 18665: Deprecate Undocumented Operator Overloads
  3. Bugzilla 19917: unions should require that all members are = void initialised
  4. Bugzilla 19969: Unhelpful error when attempting (incorrectly) to append to a string
  5. Bugzilla 20000: Casting to interfaces disallowed in @safe code
  6. Bugzilla 20024: "No property x for type Y" error not as helpful as it should be
  7. Bugzilla 20037: Imports in module info should be deduplicated
  8. Bugzilla 20053: add mixin types
  9. Bugzilla 20059: mismatched function return type inference should give location of inferred type
  10. Bugzilla 20065: Empty AliasSeq can't be used to form compiletime array literal

Phobos bugs

  1. Bugzilla 16132: std.variant.VariantN does not work with a class that inherits from a template instantiation
  2. Bugzilla 19696: ReplaceType replaces type with the type forwarding using alias this
  3. Bugzilla 19697: ReplaceType fails to compile for self-referential inheritance chains
  4. Bugzilla 19823: std.algorithm.iteration.filter's popFront doesn't always pop the first element like it's supposed to
  5. Bugzilla 19980: File.byLine skips first line in some cases when used inside map!()
  6. Bugzilla 19986: Can't assign large const T to std.Variant.VariantN
  7. Bugzilla 19987: std.variantN wastes space
  8. Bugzilla 20046: someAllocator.make!T doesn't compile if T is a shared value type
  9. Bugzilla 20064: format separator fails with leading zeros
  10. Bugzilla 20070: [2.087.0] std.conv.toImpl matches two functions when using static arrays as inout( T )
  11. Bugzilla 20097: SysTime cannot be used with std.concurrency.send
  12. Bugzilla 20129: AA require with File values gives "Error: return expression expected" in object.d

Phobos enhancements

  1. Bugzilla 16487: Add function to obtain the available disk space
  2. Bugzilla 19834: File exception for [std.file.copy] on windows shows the target file rather than the source file
  3. Bugzilla 19838: RefCounted fails to instantiate due to pureness of moveEmplace
  4. Bugzilla 19979: std.regex should return null instead of zero-length slice for non-matched captures
  5. Bugzilla 19983: Add fast path using slice assignment to std.internal.cstring.tempCString
  6. Bugzilla 19994: Can't nest self-referential Algebraic types
  7. Bugzilla 20043: Tuple.rename doesn't work with const
  8. Bugzilla 20069: std.format digit grouping separator (aka thousands separator) needs to be revisited
  9. Bugzilla 20098: Improve result of printing std.regex compiled pattern

Druntime bugs

  1. Bugzilla 20026: retrying while pthread_cond_signal/pthread_cond_broadcast return EAGAIN
  2. Bugzilla 20049: object.destroy doesn't propagate attributes
  3. Bugzilla 20066: Assertion on void[] does not compile with -checkaction=context
  4. Bugzilla 20088: void[] cast unusable in betterC due to new __ArrayCast template

Druntime enhancements

  1. Bugzilla 19976: Simplify std.internal.convert.toUbyte CTFE path for float and double
  2. Bugzilla 20104: core.atomic has no exchange function
  3. Bugzilla 20122: core.atomic.cas discards result on failure

dlang.org bugs

  1. Bugzilla 19402: specs for promotion rule of shift exp is wrong
  2. 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.

previous version: 2.087.0