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

previous version: 2.089.1

Download D 2.090.0
released Jan 05, 2020

2.090.0 comes with 10 major changes and 71 fixed Bugzilla issues. A huge thanks goes to the 48 contributors who made 2.090.0 possible.

List of all bug fixes and enhancements in D 2.090.0.

Compiler changes

  1. Can now extract delegate from lazy parameter

    The underlying delegate of the lazy parameter may be extracted using the & operator:

    void test(lazy int dg)
    {
        int delegate() dg_ = &dg;
        assert(dg_() == 7);
        assert(dg == dg_());
    }
    
    void main()
    {
        int a = 7;
        test(a);
    }
    

    Previously this caused a compile error.

Runtime changes

  1. core.memory.GC.inFinalizer was added

    A new function exposing information about the state of the GC was added. It returns true if the current thread is executing destructors (finalizers) of objects allocated on the GC heap that are either:

    • no longer being referenced
    • to whose finalizers an explicit call to GC.runFinalizers was made (usually as part of shared library unloading).

    Destructors of objects allocated on the GC heap presently have several limitations or oddities:

    • As destructors of all unreachable objects are ran in indeterministic order, there's no guarantee that object members are alive during the object's finalization
    • Allocation during finalization is disallowed
    • In contrast to stack allocated objects, partially constructed objects (object whose constructor threw an exception) may be finalized

    core.memory.GC.inFinalizer can be used to efficiently guard against programming errors such as the above, or to detect whether certain objects were left to be destroyed by the GC.

  2. Platform dependent execinfo introspection added

    A new module (core.internal.execinfo) has been added for platform dependent execinfo detection. On every POSIX system which provides an execinfo implementation as part of its C runtime the appropriate implementation- dependent execinfo module will be imported automatically.

    Besides that, there is an opportunity for using external execinfo implementations built as separated libraries and linking DRuntime with them.

    IMPORTANT: On platforms with C runtime not providing execinfo functionality one should decide whether an external lib (e.g. libexecinfo) will be used, or not. If not, DRuntime should be built normally without any additional version ID, but with external lib exactly one of the following version IDs should be chosen at compile time. That means, the selected external format cannot be changed later without rebuilding DRuntime.

    It could be really important to keep this in mind when someone is packaging DRuntime for such OSs (e.g. ones using musl libc) and provide packages with and without execinfo support (with the specific external library as dependency) or in the case of source based packages, make this build option selectable (e.g. portage).

    Version IDBacktrace format
    ExtExecinfo_BSDFmt0x00000000 <_D6module4funcAFZv+0x78> at module
    ExtExecinfo_DarwinFmt1 module 0x00000000 D6module4funcAFZv + 0
    ExtExecinfo_GNUFmtmodule(_D6module4funcAFZv) [0x00000000] or module(_D6module4funcAFZv+0x78) [0x00000000] or module(_D6module4funcAFZv-0x78) [0x00000000]
    ExtExecinfo_SolarisFmtobject'symbol+offset [pc]

    These formats above cover most of the "classic" backtrace outputs but as a new important format emerges, it can be easily added.

  3. Added intrinsic toPrec to round to a specific float precision

    The intrinsic core.math.toPrec forces rounding of it floating point argument to the precision of float, double, or real.

    Some floating point algorithms, such as Kahan-Babuska-Neumaier Summation, require rounding to specific precisions. Rounding to precision after every operation, however, loses overall precision in the general case and is a runtime performance problem.

    Adding these functions guarantee the rounding at required points in the code, and document where in the algorithm the requirement exists.

  4. Unittest default mode

    Switched the default for unittests to only run the tests by default. Use --DRT-testmode=run-main for the original behavior (run unittests then main).

    The feature to control unit testing was added in 2.078.0, and the switch above will work for all versions since then.

Library changes

  1. Deprecated std.array.Appender.toString was removed

    The overload accepting a callable was deprecated since 2.079 and has now been removed. Use the overload accepting an output range instead.

  2. Deprecated std.functional.binaryReverseArgs was removed

    This specialisation of reverseArgs accepting exactly two arguments was deprecated since 2.079 and has now been removed. Use reverseArgs instead.

  3. Deprecated std.bitmanip.BitArray.toString was removed

    The overload accepting a callable was deprecated since 2.079 and has now been removed. Use the overload accepting an output range instead.

  4. Deprecated module std.experimental.all was removed

    All symbols contained in Phobos can now be used with import std

  5. Added get!(T) getter to std.json

    This getter will try to return underlying json type as T if possible. It is convenient for automatic integer conversion like this:

    import std.json;
    string s = `{ "a": 123 }`;
    auto json = parseJSON(s);
    
    // This will throw with json["a"].floating
    assert(json["a"].get!double == 123.0);
    

List of all bug fixes and enhancements in D 2.090.0:

DMD Compiler regressions

  1. Bugzilla 20383: [REG 2.084.z] illegal conversion from int[] to ubyte[] is accepted
  2. Bugzilla 20418: Unittest failure in bitarray.d on Win32
  3. Bugzilla 20465: Dynamic + static array declaration fail

DMD Compiler bugs

  1. Bugzilla 6592: di header file created even if errors occur
  2. Bugzilla 8684: Missing ')' in argument list creates a sea of error messages
  3. Bugzilla 9490: 'this' is not found when expression is in parentheses
  4. Bugzilla 10562: Cannot initialize arrays by an element value when the elements are fixed-length arrays
  5. Bugzilla 14696: destructor for temporary called before statement is complete with conditional operator
  6. Bugzilla 17125: Header Generation Incorrectly Formats Floating Point Number
  7. Bugzilla 19432: Cannot initialize ulong with decimal value above signed long range
  8. Bugzilla 20151: particular directory layout causes DMD to crash with an access violation
  9. Bugzilla 20220: pragma(crt_constructor) does not work with clang 9
  10. Bugzilla 20318: Illegal instruction (core dumped)
  11. Bugzilla 20326: stringof on opaque type results in forward reference error
  12. Bugzilla 20367: Postblit cannot be disabled when copy ctor is defined
  13. Bugzilla 20400: CTFE increasing length of array of characters changes its value
  14. Bugzilla 20401: ref variable copied before return
  15. Bugzilla 20406: Copy constructor requires default constructor
  16. Bugzilla 20413: C++ mangling bug with templates & the std namespace
  17. Bugzilla 20417: __traits(compiles) returns false result if expression is not wrapped inside a lambda while typeof works correctly
  18. Bugzilla 20419: is(missing == module/package) results in unknown identifier
  19. Bugzilla 20466: Optimizer clobbering msw register when testing it for 0
  20. Bugzilla 20475: Struct of static array of strings is bitwise-compared instead of member-wise

DMD Compiler enhancements

  1. Bugzilla 4544: Better error-message when expecting string but got a character constant
  2. Bugzilla 11038: static has no effect as a block attribute for imports
  3. Bugzilla 18809: Improve error message on nonexistent property
  4. Bugzilla 20334: posix.mak clean target does not remove all generated files
  5. Bugzilla 20448: Error: unknown when mutating an escaped member reference from a template function

Phobos bugs

  1. Bugzilla 9588: format prints context pointer for struct
  2. Bugzilla 9592: Justified Tuple printing
  3. Bugzilla 10126: Make TaskPool terminate on its own or improve docs to make it clear that it won't
  4. Bugzilla 10448: min and max are not NaN aware
  5. Bugzilla 10902: some phobos unittests take an excessive amount of time
  6. Bugzilla 11013: ignoring variable inside the predicate of findSplitBefore
  7. Bugzilla 11782: format pointer to range prints range
  8. Bugzilla 15405: FormatSpec.writeUpToNextSpec() not documented
  9. Bugzilla 15940: ImplicitConversionTargets and class alias in struct
  10. Bugzilla 16223: BigUint: undefined shift for small instantiation type
  11. Bugzilla 18248: radix overload of std.conv.parse fails to throw on non-empty range without number
  12. Bugzilla 18446: Wrong curl onProgress examples
  13. Bugzilla 19283: [std.mathspecial] documentation for normal distribution doesn't list parameters
  14. Bugzilla 19626: RedBlackTree of an enum fails in unittest mode
  15. Bugzilla 19733: expi documentation links broken
  16. Bugzilla 20160: ThreadInfo.cleanup() clears local thread's registered names instead of "this"'s
  17. Bugzilla 20260: CustomFloat with 0 precision/exponentWidth
  18. Bugzilla 20261: CustomFloat.epsilon yields infinity
  19. Bugzilla 20263: Wrong value for CustomFloat.min_exp
  20. Bugzilla 20281: CustomFloat is limited to 64 bit
  21. Bugzilla 20282: CustomFloat.dig fails at some values.
  22. Bugzilla 20283: CustomFloat.max_exp not working in some cases
  23. Bugzilla 20284: CustomFloat.max_10_exp does not work for types with too many digits in exponent
  24. Bugzilla 20286: CustomFloat.min_normal fails, when not allowDenorm
  25. Bugzilla 20313: Inconsistent behavior of wouldHaveBlocked on Windows
  26. Bugzilla 20314: passing const variables to only forces const range element type
  27. Bugzilla 20357: format should obey space flag when printing nan or inf
  28. Bugzilla 20396: format!"%a" leeds to wrong result for denormalized float
  29. Bugzilla 20398: Wrong number of totalEntries in std.zip
  30. Bugzilla 20408: style checker should not check backup files

Phobos enhancements

  1. Bugzilla 20198: Make std.math.nextUp and nextDown and nextafter work in CTFE for float and double
  2. Bugzilla 20288: std.format double with NaN fails with range violation on comma
  3. Bugzilla 20425: Proxy opCmp fails to compile with types that overloaded opCmp
  4. Bugzilla 20439: memoize fails with types that have a void opAssign

Druntime bugs

  1. Bugzilla 20299: checkaction=context not working with temporary destructors
  2. Bugzilla 20303: Memory leak in core.thread
  3. Bugzilla 20315: checkaction=context fails for const(void[]) argument
  4. Bugzilla 20322: checkaction=context fails for wstring/dstring arguments
  5. Bugzilla 20323: checkaction=context fails for non-copyable arguments
  6. Bugzilla 20346: std.uuid does not compile with checkaction=context
  7. Bugzilla 20364: [REG2.069] changing length for typeof(null)[] array seg faults in _d_arraysetlengthiT()
  8. Bugzilla 20440: Associative arrays with values whose opAssign doesn't return a ref don't support require function

Druntime enhancements

  1. Bugzilla 17563: gc_inFinalizer should be public

Contributors to this release (48)

A huge thanks goes to all the awesome people who made this release possible.

previous version: 2.089.1