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.075.0 (upcoming)

previous version: 2.074.0
$(NIGHTLY_VERSION To be released, , ,
List of all upcoming bug fixes and enhancements.

Compiler changes

  1. add __traits(getFunctionVariadicStyle, f)

    Bugzilla 17421

    import core.stdc.stdarg;
    
    void novar() {}
    extern(C) void cstyle(int, ...) {}
    extern(C++) void cppstyle(int, ...) {}
    void dstyle(...) {}
    void typesafe(int[]...) {}
    
    static assert(__traits(getFunctionVariadicStyle, novar) == "none");
    static assert(__traits(getFunctionVariadicStyle, cstyle) == "stdarg");
    static assert(__traits(getFunctionVariadicStyle, cppstyle) == "stdarg");
    static assert(__traits(getFunctionVariadicStyle, dstyle) == "argptr");
    static assert(__traits(getFunctionVariadicStyle, typesafe) == "typesafe");
    
    static assert(__traits(getFunctionVariadicStyle, (int[] a...) {}) == "typesafe");
    static assert(__traits(getFunctionVariadicStyle, typeof(cstyle)) == "stdarg");
    
  2. Comparison that takes into account the enumerated type improves code correctness by

    disallowing comparison of unrelated enumerated types.

    This change does not affect anonymous enumerations.

    enum Status
    {
        good,
        bad
    }
    enum OtherStatus
    {
        ok
        no,
    }
    
    // Deprecated - Even though both good and ok evaluate to 0 they belong to
    // different enumeration types
    static assert(Status.good == OtherStatus.ok);
    

Runtime changes

  1. TypeInfo.init now refers to type property.

    TypeInfo.init used to refer to the method that is now called TypeInfo.initializer. The name change was necessary because the name "init" would clash with the type property of the same name (init). TypeInfo.init now refers to the type property.

  2. Make fiber stack protection-page size configurable

    It is now possible to change the guard page size by using the new Fiber's constructor argument - guard_page_size. It defaults to PAGE_SIZE (the same it used to be on Windows), and specifying 0 will turn this feature off.

  3. Add Fiber's stack-protection page for Posix.

    The feature already existing for Windows' fiber implementation is now added to the systems using mmap to allocate fibers' stacks: After (or before) the last page used for the Fiber's stack, the page is allocate which is protected for any kind of access. This will cause system to trap immediately on the fiber's stack overflow. If in debugger session, one can inspect contents of the memory before or after stack pointer and it can be seen if it contains END OF FIBER string pattern.

Library changes

  1. std.range.slide (a fixed-size sliding window range) was added

    std.range.slide allows to iterate a range in sliding windows:

    import std.array : array;
    import std.algorithm.comparison : equal;
    
    assert([0, 1, 2, 3].slide(2).equal!equal(
        [[0, 1], [1, 2], [2, 3]]
    ));
    assert(5.iota.slide(3).equal!equal(
        [[0, 1, 2], [1, 2, 3], [2, 3, 4]]
    ));
    
    assert(iota(7).slide(2, 2).equal!equal([[0, 1], [2, 3], [4, 5]]));
    assert(iota(12).slide(2, 4).equal!equal([[0, 1], [4, 5], [8, 9]]));
    
    // set a custom stepsize (default 1)
    assert(6.iota.slide(1, 2).equal!equal(
        [[0], [2], [4]]
    ));
    
    assert(6.iota.slide(2, 4).equal!equal(
        [[0, 1], [4, 5]]
    ));
    
    // allow slide with less elements than the window size
    assert(3.iota.slide!(No.withFewerElements)(4).empty);
    assert(3.iota.slide!(Yes.withFewerElements)(4).equal!equal(
        [[0, 1, 2]]
    ));
    
  2. Several functions in std.string have been deprecated

    The functions std.string.inPattern, std.string.countchars, std.string.removechars, std.string.squeeze, and std.string.munch, have all been deprecated. These functions are obsolete, as their functionality is better covered by the functions in std.regex and std.algorithm. They will be removed from std.string on May 2018.

    If you still need to use these, please see undeaD.

  3. Added support for 64 bit CRC

    Support for both ISO and ECMA 64 bit CRC was added to std.digest.crc.

    import std.digest.crc;
    
    void main()
    {
        ubyte[8] hash64ecma = crc64ECMAOf("abc");
        assert(crcHexString(hash64ecma) == "2CD8094A1A277627");
    
        ubyte[8] hash64iso = crc64ISOOf("abc");
        assert(crcHexString(hash64iso) == "3776C42000000000");
    }
    
  4. Added a constant time comparison function for cryptographic hashes

    Added a new function to std.digest.digest.secureEqual that compares two ranges that represent hashes in a secure manner. The comparison is done in constant time regardless of the equality of the two ranges in order to protect against timing attacks. For more information on the attack, please refer to the docs on std.digest.digest.secureEqual.

    import std.digest.digest : secureEqual, toHexString;
    import std.digest.hmac : hmac;
    import std.digest.sha : SHA1;
    import std.string : representation;
    
    void main()
    {
        // a typical HMAC data integrity verification
        auto secret = "A7GZIP6TAQA6OHM7KZ42KB9303CEY0MOV5DD6NTV".representation;
        auto data = "data".representation;
    
        string hex1 = data.hmac!SHA1(secret).toHexString;
        string hex2 = data.hmac!SHA1(secret).toHexString;
    
        string hex3 = "data1".representation.hmac!SHA1(secret).toHexString;
    
        assert( secureEqual(hex1, hex2));
        assert(!secureEqual(hex1, hex3));
    }
    
  5. std.datetime has been split into a package.

    std.datetime is now a package containing the following modules:

    std.datetime.package publicly imports all of those modules. So, it should be the case that no existing code will break, as everything in std.datetime will still be imported by importing std.datetime. New code can choose to import the modules individually or to import the entire package.

    std.datetime.date contains Date, TimeOfDay, DateTime, and the related free functions. It also contains DateTimeException.

    std.datetime.interval contains the *Interval and *IntervalRange types as well as the related free functions.

    std.datetime.systime contains SysTime and the related free functions.

    std.datetime.timezone contains the time zone types.

    std.datetime.package contains StopWatch and the benchmarking functions (so, they can only be imported via std.datetime and not via a submodule). As those functions use core.time.TickDuration (which is being replaced by core.time.MonoTime, they are slated for deprecation. )

    std.datetime.stopwatch has been added. It contains versions of StopWatch and benchmark which have almost the same API as the existing symbols, but they use core.time.MonoTime and core.time.Duration instead of core.time.TickDuration. In the next major release, the old functions in std.datetime.package will be deprecated, so code which uses the old benchmarking functions should be updated to use std.datetime.stopwatch.

    However, note that in order to avoid irreconcilable symbol conflicts between the new and old versions, std.datetime.stopwatch will not be publicly imported by std.datetime.package until the old symbols have been removed. So, for the time being, code using std.datetime.stopwatch.StopWatch or std.datetime.benchmark.StopWatch will need to import std.datetime.stopwatch directly. Code which imports both std.datetime and std.datetime.stopwatch will need to either use selective imports or fully qualified symbols to reconcile the symbol conflicts, but no code will be affected by the changes until it's updated to import std.datetime.stopwatch, and when the old symbols are finally removed, the selective imports and fully qualified paths to the new symbols will continue to work and won't break (though at that point, simply importing std.datetime will work, since std.datetime.package will have been updated to publicly import std.datetime.stopwatch). Code that simply imporst std.datetime.stopwatch without importing std.datetime will not have to worry about symbol conflicts.


  6. List of all bug fixes and enhancements in D 2.075.0 (upcoming):

    DMD Compiler regressions

    1. Bugzilla 16408: [REG2.065] left-to-right order of evaluation of function arguments not consistently followed
    2. Bugzilla 17338: [Reg 2.075] link failure unsupported symbol section 0xff01
    3. Bugzilla 17356: [Reg 2.075] __simd_sto no longer executed
    4. Bugzilla 17407: [REG] __traits(compiles) triggers assertion failure

    DMD Compiler bugs

    1. Bugzilla 7016: local import does not create -deps dependency
    2. Bugzilla 13331: naked asm functions are broken when compiling with -profile
    3. Bugzilla 15896: private ignored when import bindings are used
    4. Bugzilla 17289: With Xcode 8.3 linker, warnings of "pointer not aligned"
    5. Bugzilla 17335: Function calls in conjunctions do not short circuit when evaluated during compilation
    6. Bugzilla 17337: SIGILL for AVX vector initialization
    7. Bugzilla 17339: ambiguous mangling with const alias argument
    8. Bugzilla 17344: ICE with assignment of post inc-/decremented integral vector
    9. Bugzilla 17367: CodeView/MSCOFF: bad debug information for enumerators
    10. Bugzilla 17391: SECURITY: XSS through DDOC comments

    DMD Compiler enhancements

    1. Bugzilla 6227: Comparison of different enums
    2. Bugzilla 16197: Constructors/postblits and destructors don't match up for array initialisation
    3. Bugzilla 16540: Attributes do not propagate correctly in lazy params
    4. Bugzilla 17396: Add colorized syntax highlighting to error messages emitted by dmd
    5. Bugzilla 17419: add __traits(getLinkage, s) to the the linkage of symbol s

    Phobos bugs

    1. Bugzilla 15534: [std.experimental.logger.core] Documentation mismatch
    2. Bugzilla 15720: iota(long.max, long.min, step) does not work properly
    3. Bugzilla 15763: std.math.approxEqual is not symmetric
    4. Bugzilla 16232: std.experimental.logger.core.sharedLog isn't thread-safe
    5. Bugzilla 16246: cannot call iota with 3 [u]bytes or 3 [u]shorts
    6. Bugzilla 16326: filter is not lazy enough & has weird save behavior
    7. Bugzilla 17251: Appender.put errors out with const input range elements
    8. Bugzilla 17270: std.experimental.Final fails on pointers
    9. Bugzilla 17283: std.experimental.typecons uses private module members
    10. Bugzilla 17288: formattedWrite error when width/precision provided and no value to format
    11. Bugzilla 17314: BinaryHeap crashes upon insertion if heapified with an array of length 1

    Phobos enhancements

    1. Bugzilla 6621: Superimposition amount for std.range.chunks
    2. Bugzilla 7102: std.numeric.gcd with BigInts too
    3. Bugzilla 10001: string formatting with underscores
    4. Bugzilla 17286: A function for comparing two digests securely
    5. Bugzilla 17327: std.getopt: repeated options unrecognised
    6. Bugzilla 17394: std.file.mkdirRecurse isn't @safe

    Druntime bugs

    1. Bugzilla 12233: Attempting to use TypeInfo.init results in a compiler error due to lack of 'this'.
    2. Bugzilla 13186: core/sys/posix/sys/uio.d is not linked into the standard lib

    dlang.org bugs

    1. Bugzilla 17303: type error in the href url under the link Systems Programming
previous version: 2.074.0