Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

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

Download D 2.076.0
released Sep 1, 2017

#### Compiler changes

1. Implement DIP 1010 - Static foreach
2. -betterC enhancements
3. AVX2 was added as -mcpu=avx2 architecture.
4. Fix Issue 17697 - Ddoc: automatically highlight URLs outside of macro arguments

#### Runtime changes

1. Print unhandled exception's trace and abort if rt_trapExceptions is false

#### Library changes

1. Base64URLNoPadding (URL-safe Base64 without padding) was added
2. std.digest.digest was renamed to std.digest.
3. std.meta.Stride was added
4. Config.detached flag for spawnProcess has been added
5. std.range.chunks was extended to support non-forward input ranges.
6. std.socket.UnixAddress now supports abstract addresses.
7. Added possibility to use a baseclass when auto-implementing an interface

#### Tools changes

1. rdmd now checks for a D compiler binary in the directory it's in first

List of all bug fixes and enhancements in D 2.076.0.

#### Compiler changes

1. Implement DIP 1010 - Static foreach

   Support for static foreach has been added.

   static foreach is a conditional compilation construct that is to foreach what static if is to if. It is a convenient way to generate declarations and statements by iteration.

       import std.conv: to;

       static foreach(i; 0 .. 10)
       {

           // a `static foreach` body does not introduce a nested scope
           // (similar to `static if`).

           // The following mixin declaration is at module scope:
           mixin(`enum x` ~ to!string(i) ~ ` = i;`); // declares 10 variables x0, x1, ..., x9
       }

       import std.range: iota;
       // all aggregate types that can be iterated with a standard `foreach`
       // loop are also supported by static foreach:
       static foreach(i; iota(10))
       {
           // we access the declarations generated in the first `static foreach`
           pragma(msg, "x", i, ": ", mixin(`x` ~ to!string(i)));
           static assert(mixin(`x` ~ to!string(i)) == i);
       }

       void main()
       {
           import std.conv: text;
           import std.typecons: tuple;
           import std.algorithm: map;
           import std.stdio: writeln;

           // `static foreach` has both declaration and statement forms
           // (similar to `static if`).

           static foreach(x; iota(3).map!(i => tuple(text("x", i), i)))
           {
               // generates three local variables x0, x1 and x2.
               mixin(text(`int `,x[0],` = x[1];`));

               scope(exit) // this is within the scope of `main`
               {
                   writeln(mixin(x[0]));
               }
           }

           writeln(x0," ",x1," ",x2); // first runtime output
       }

2. -betterC enhancements

   Many improvements were added to the dmd's -betterC implementation, most notably programs compiled with -betterC will no longer reference unused druntime symbols, asserts are implemented as C <assert.h> calls, and phobos is not linked by default.

   See the Better C specs for more details.

3. AVX2 was added as -mcpu=avx2 architecture.

   This allows the backend to emit AVX2 instructions. The compiler will add the predefined version D_AVX2. AVX2 support is automatically detected with -mcpu=native.

4. Fix Issue 17697 - Ddoc: automatically highlight URLs outside of macro arguments

   URLs which appear in Ddoc text:

       /****
        * http://www.fooa.com/test1
        */

   will be treated as if they were written:

       /****
        * $(LINK http://www.fooa.com/test1)
        */

   and a clickable hyperlink will be emitted to the resulting .html file.

   This detection does not happen if the URL is part of a macro argument:

       /****
        * $(DOLLAR)$(LPAREN)ABC http://www.fooa.com/test1$(RPAREN)
        */

   The behavior of that is unchanged. URLs can start with http:// or https://

   http: and https: at the beginning of the line are no longer treated as section headings.

#### Runtime changes

1. Print unhandled exception's trace and abort if rt_trapExceptions is false

   D exception handling was assuming the top level exception handler, so all exceptions would be handled somewhere. In case rt_trapExceptions is cleared, this handler would not be enabled, and this assertion would fail, aborting the program, but without any information about the exception. This is now changed, so the exception information will be printed to the stderr, followed by abort.

#### Library changes

1. Base64URLNoPadding (URL-safe Base64 without padding) was added

   std.base64.Base64URLNoPadding allows encoding/decoding without padding:

       import std.base64 : Base64URLNoPadding;

       ubyte[] data = [0x83, 0xd7, 0x30, 0x7b, 0xef];
       assert(Base64URLNoPadding.encode(data) == "g9cwe-8");
       assert(Base64URLNoPadding.decode("g9cwe-8") == data);

2. std.digest.digest was renamed to std.digest.

   Motivation:

   The fully qualified name of the digest function template was std.digest.digest.digest. This is because std.digest is a package, with a module named digest in it, and the function digest inside that.

   std.digest contains the former std.digest.digest package.

3. std.meta.Stride was added

   std.meta.Stride allows selecting a subset of template by a step size and offset:

       alias attribs = AliasSeq!(short, int, long, ushort, uint, ulong);
       static assert(is(Stride!(3, attribs) == AliasSeq!(short, ushort)));
       static assert(is(Stride!(3, attribs[1 .. $]) == AliasSeq!(int, uint)));

4. Config.detached flag for spawnProcess has been added

   Config.detached allows spawning processes which run independently from the current process. There is no need to wait on the processes created with this flag, and no zombie process will be left after they exit. Attempts to call std.process.wait or std.process.kill on detached processes will throw.

5. std.range.chunks was extended to support non-forward input ranges.

   Now std.range.chunks can be used with input ranges that are not forward ranges, albeit with limited semantics as imposed by the underlying range.

       import std.algorithm.comparison : equal;

       int i;

       // The generator doesn't save state, so it cannot be a forward range.
       auto inputRange = generate!(() => ++i).take(10);

       // We can still process it in chunks, but it will be single-pass only.
       auto chunked = inputRange.chunks(2);

       assert(chunked.front.equal([1, 2]));
       assert(chunked.front.empty); // Iterating the chunk has consumed it
       chunked.popFront;
       assert(chunked.front.equal([3, 4]));

6. std.socket.UnixAddress now supports abstract addresses.

   UNIX domain sockets are usually identified by pathnames. Linux offers a non-portable extension to this scheme, known as abstract socket addresses, which are independent of the filesystem. An abstract socket address starts with a null byte ('\0'), e.g.:

       auto addr = new UnixAddress("\0/tmp/dbus-OtHLWmCLPR");

7. Added possibility to use a baseclass when auto-implementing an interface

   A second std.typecons.AutoImplement template has been added, which differs from the existing one in accepting an extra type parameter. The extra parameter specifies a class to derive from while auto-implementing an interface.

   The base class used may contain non-default constructors. Matching constructors will be created in the auto-implemented class and be implemented as just a call to super with all arguments.

#### Tools changes

1. rdmd now checks for a D compiler binary in the directory it's in first

   If you downloaded a zip/tar file with the compiler before and ran rdmd, it would invoke the D compiler from the system PATH rather than the compiler right next to it, failing if there wasn't one in the PATH. rdmd will now try to use the D compiler next to it first, and only fall back to the PATH if there isn't one adjacent. If you want rdmd to run a specific compiler, add the --compiler flag to force it, as always.

   To restore the old behaviour of only using the compiler from your PATH, add --compiler=dmd (or ldmd2 or gdmd).

List of all bug fixes and enhancements in D 2.076.0:

#### DMD Compiler regressions

1. Bugzilla 16680: dmd doesn't use druntime optimized versions of subtraction array operations
2. Bugzilla 17522: win64.mak broken
3. Bugzilla 17582: [REG2.059] Applying const to struct declaration should make the struct type const
4. Bugzilla 17612: [REG2.063] Segmentation fault with bad object.d
5. Bugzilla 17684: [REG 2.062] static alias this bug or incomplete implementation?
6. Bugzilla 17690: [REG2.066.0] scope guards leak declarations
7. Bugzilla 17695: [Reg 2.076] ICE with vector negation
8. Bugzilla 17761: [REG2.075] dmd 2.075.1 creates object files that can't be linked by ld.bfd

#### DMD Compiler bugs

1. Bugzilla 4014: CodeView debug type info not linked in from library
2. Bugzilla 11881: -betterC switch suffers from bit rot
3. Bugzilla 11997: rdmd should search its binary path for the compiler
4. Bugzilla 13512: Allow non-UTF-8 encoding in shebang line
5. Bugzilla 15432: Win64: bad code offset in debug line number info
6. Bugzilla 16640: void fun(string file=__FILE_FULL_PATH__) returns relative path
7. Bugzilla 17380: Compiler segfaults on undefined symbol
8. Bugzilla 17388: [scope] e[] should be treated like &e as far as scope goes
9. Bugzilla 17430: [scope] delegate can escape context ptr
10. Bugzilla 17484: high penalty for vbroadcastsd with -mcpu=avx
11. Bugzilla 17489: ICE in ddmd/argtypes.d
12. Bugzilla 17551: VC build: bad mangling of real template argument
13. Bugzilla 17629: package.di files cannot be used
14. Bugzilla 17660: ICE with static foreach: AssertError@ddmd/visitor.d(39)
15. Bugzilla 17688: ICE with static foreach directly inside switch
16. Bugzilla 17689: finally clause leaks declarations
17. Bugzilla 17721: Wrong expression type using vector extensions with shift operands
18. Bugzilla 17722: Wrong diagnostic using __traits(compiles, e1 && e2) expressions.
19. Bugzilla 17735: AssertError@ddmd/target.d(357): unhandled op using fish operators

#### DMD Compiler enhancements

1. Bugzilla 9287: DMD should read from stdin when an input file is "-"
2. Bugzilla 9731: Ddoc should output per-paragraph macro instead of (DDOC_BLANKLINE)
3. Bugzilla 17392: Add Dub file for the lexer and parser
4. Bugzilla 17428: [scope] class field assignment allows to escape scope parameters
5. Bugzilla 17499: with -betterC switch, call C's assert failure function rather than druntime's
6. Bugzilla 17521: -betterC programs should not link in Phobos runtime library by default
7. Bugzilla 17590: Unnecessary GC alloc on returning static local struct
8. Bugzilla 17697: Ddoc: automatically highlight URLs outside of macro arguments

#### Phobos regressions

1. Bugzilla 17650: [REG v2.075.0 b1-b4] std.getopt range violation
2. Bugzilla 17661: New isInputRange rejects valid input range
3. Bugzilla 17724: digest is not a template declaration, it is a module

#### Phobos bugs

1. Bugzilla 6718: "nWayUnion" => "nWayMerge", plus true nWayUnion
2. Bugzilla 12260: Improve error of std.stdio.readf when involving whitespace
3. Bugzilla 12866: Append to std.container.Array of fixed size arrays
4. Bugzilla 16079: memoize should cache objects too
5. Bugzilla 16191: std/digest/digest.d should be renamed to package.d
6. Bugzilla 17389: std.traits.hasNested fails for class with member of same type
7. Bugzilla 17458: [std.regex] Assertion failure in package.d
8. Bugzilla 17539: std.parallellism.parallel triggers 'statement not reachable' warnings in the rdmd_test suite
9. Bugzilla 17562: Tangent function returns NaN for abs(input) >= 2^63
10. Bugzilla 17574: Range violation in std.getopt:getopt AA parsing
11. Bugzilla 17616: makeIndex cannot fully use range of index type
12. Bugzilla 17640: std.concurrenct writeln conflicts with std.stdio writeln in unittests
13. Bugzilla 17673: wrong whichPattern in multi-regex with alteration
14. Bugzilla 17711: std.array.byPair should be usable with const AA
15. Bugzilla 17780: Malformed DDOC links in std.range

#### Phobos enhancements

1. Bugzilla 2137: Data not compressed on fly when adding to zip archive
2. Bugzilla 6384: std.traits.isComparable
3. Bugzilla 15759: chunks should work with only an input range
4. Bugzilla 15771: FileLogger should create the output directory if it does not exist
5. Bugzilla 16062: Add 'clear' method to OutBuffer (std.outbuffer)
6. Bugzilla 16993: Documentation for toSimpleString and toString does not explain how they differ
7. Bugzilla 17250: ProcessPipes (std.process) should provide a test for a null pid
8. Bugzilla 17365: https://dlang.org/phobos/std_experimental_checkedint.html is missing the Throw hook description
9. Bugzilla 17369: [Module std.traits] Documentation lists ditto in table
10. Bugzilla 17525: std.algorithm.searching.skipOver should have a single argument with pred version
11. Bugzilla 17540: std.net.curl: HTTP no possibillity to set CURLOPT_NOPROXY
12. Bugzilla 17587: JSONOptions: No forward slash encoding

#### Druntime regressions

1. Bugzilla 15619: [REG 2.066] Floating-point x86_64 codegen regression, when involving array ops

#### Druntime bugs

1. Bugzilla 11594: synchronized causing segfault instead of Error.
2. Bugzilla 14319: core.demangle does not support member function attributes
3. Bugzilla 14563: core.demangle: Does not demangle type modifers
4. Bugzilla 14576: [ddemangle] core.demangle unable to handle ambiguity in symbols
5. Bugzilla 16856: D does not work on FreeBSD current (what will eventually be 12) due to libunwind
6. Bugzilla 17609: core.demangle demangles delegate variables as functions
7. Bugzilla 17610: core.demangle shows return type of template alias parameter
8. Bugzilla 17611: core.demangle cannot demangle delegates with function attributes
9. Bugzilla 17624: typo in Fields documentation section of https://dlang.org/library/object/exception.html
10. Bugzilla 17665: Win64 atomicLoad for T[] cannot be cast from size_t[2]

#### Druntime enhancements

1. Bugzilla 16664: core.demangle functions are not callable from @safe or pure code

#### dlang.org bugs

1. Bugzilla 17159: Behavior of unions at compile time is not documented
2. Bugzilla 17224: Foreach documentation still refers to TypeTuples, rather than AliasSequences
3. Bugzilla 17305: [SPEC] ABI page still has references to D1 Phobos
4. Bugzilla 17509: [typo] "refered to" ("referred to")
5. Bugzilla 17510: How could 509 be a byte value?
6. Bugzilla 17513: [english] "a enum" -> "an enum"
7. Bugzilla 17702: codemirror hangs firefox for several seconds

#### dlang.org enhancements

1. Bugzilla 13153: dlang.org: provide version-specific documentation of the language and stdlib
2. Bugzilla 17262: Better docs for rdmd
3. Bugzilla 17322: Add Magikcraft to organizations using D
4. Bugzilla 17480: [Downloads]
5. Bugzilla 17524: [The C Preprocessor vs D] "need to worry about"?
6. Bugzilla 17560: Enhancement: view and copy full code example for offline compile/play
7. Bugzilla 17581: Document behavior of -betterC
8. Bugzilla 17594: Define DDOC_BLANKLINE as an empty HTML paragraph, thus obviating the need to wrap text in (P ...)

#### Tools bugs

1. Bugzilla 17731: dman fails to build due to more than 32767 symbols

Copyright © 1999-2021 by the D Language Foundation | Page generated by Ddoc on Thu Jun 3 21:31:44 2021