Change Log: 2.071.0 - D Programming Language

Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - 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.071.0

Download D 2.071.0
released Apr 5, 2016

#### Compiler Changes

1. Import access checks for fully qualified names were fixed.
2. Protection for selective and renamed imports were fixed.

#### Language Changes

1. Imports no longer hide locals declared in outer scopes.
2. Private symbols are no longer visible in other modules.
3. Manifest constant can now be used for deprecation message.

#### Library Changes

1. A clear method has been added to associative arrays to remove all elements.
2. The GC now uses a spinlock instead of a recursive mutex.
3. Calls to GC.free are now ignored during finalization instead of throwing an InvalidMemoryOperationError, see Bugzilla 15353.
4. GC.addRoot and GC.addRange now use a separate lock.
5. GCAllocator.goodAllocSize was added.
6. High-level API of std.net.curl now uses Appender for received content. Which generally makes all calls slightly faster. Up to 200ms for large amounts of data.
7. Repeat was added to obtain a repeating AliasSeq consisting of template arguments.
8. fold was added as an alternative to reduce with argument order swapped.
9. Added nextPow2 and truncPow2 to std.math.
10. bsf, bsr, and popcnt now work with ulongs on 32 bit systems.
11. topN is now 5% - 7% faster.
12. Unary overloads of startsWith and endsWith were added.
13. maxCount and maxPos were added.
14. Range support for the convenience wrapper redBlackTree was added.

List of all bug fixes and enhancements in D 2.071.0.

#### Compiler Changes

1. Import access checks for fully qualified names were fixed.

   It is no longer possible to bypass private imports by using fully qualified names, e.g. the following example will fail with package std.range is not accessible here.

       import std.algorithm;

       static assert(std.range.isForwardRange!string);

   To ease updating existing code, the old behavior was retained but deprecated.

2. Protection for selective and renamed imports were fixed.

   It is no longer possible to use private selective or renamed imports in another module, e.g. the following example will fail with a.File is not visible from module b.

       module a;
       import std.stdio : File; // imports are private by default

       module b;
       import a;

       File f; // File is private

   To ease updating existing code, the old behavior was retained but deprecated. This fix relies on the visibility changes introduced with DIP22.

#### Language Changes

1. Imports no longer hide locals declared in outer scopes.

   These changes were made to the name lookup algorithm:

   1. Lookup for unqualified names is change from one pass to two pass. The first pass goes through the scopes but does not check import declarations. If not found, the second pass goes through the scopes and only looks at import declarations.
   2. Qualified name lookups, base class lookups, and WithStatement lookups no longer search import declarations, unless a module is the subject of the lookup, where the behavior remains as before.

   This can break existing code, although reliance on the previous behavior tends to be unintended, and fixing it improves the comprehensibility of the code. Breakage tends to take the form of a symbol now being flagged as undefined. Fixing the breakage can be done by fully qualifying the name, or adding an alias to the import declaration.

   The old lookup behavior can be restored using the -transition=import compiler switch. With -transition=checkimports the compiler will issue deprecation warnings when the old and new lookup find different symbols. You can combine both switches to use the old lookup and still get deprecation warnings.

   See also Bugzilla 10378

2. Private symbols are no longer visible in other modules.

   Protection (private, package, protected) is now already enforced during symbol lookup in order to resolve any conflicts between private and public symbols that could occur with the old access check scheme.

   The visibility of overloaded symbols with mixed protection is determined by the most visibile member, but additional access check against the exact symbol is performed after overload resolution.

   To ease updating existing code, a deprecated search for invisible symbols will be performed. For the the old lookup behavior (using the -transition=import or -transition=checkimports compiler switch) symbol visibility is ignored. All existing access checks remain active during the deprecation phase.

   See also DIP22

3. Manifest constant can now be used for deprecation message.

   Manifest constants (enum, static immutable) can now be used for deprecation message, as well as concatenated strings.

   Example:

       string generateMessage() { return "Some deprecation message"; }
       enum DepMsg = generateMessage();

       deprecated(DepMsg) class Foo {}
       deprecated("Some long deprecation " ~ "message") class Bar {}

#### Library Changes

1. A clear method has been added to associative arrays to remove all elements.

   One can now use aa.clear() to remove all elements from an associative array. This allows removing all elements from all references to the same array (setting to null just reset the reference, but did not removed the elements from other references).

       auto aa = ["first" : "entry", "second": "entry"];
       auto aa2 = aa1; // reference to the same AA
       aa.clear(); // still retains its current capacity for faster imports
       assert(aa2.length == 0); // other references affected

2. The GC is no longer wrapped in a pthread_mutex, it now uses a spinlock.

   This results in a 5% faster GC on average, with the most benefits going to multi-threaded programs that use the GC. See druntime#1447 for more details.

3. Added nextPow2 and truncPow2 to std.math.

   nextPow2 and truncPow2 are functions for rounding numbers to powers of two.

       import std.math;

       assert(nextPow2(10) == 16);
       assert(nextPow2(4000) == 4096);

       assert(truncPow2(10) == 8);
       assert(truncPow2(4000) == 2048);

4. Unary overloads of startsWith and endsWith were added.

   startsWith and endsWith can now be used just with a predicate.

       import std.algorithm.searching;
       import std.ascii : isAlpha;

       assert("abc".endsWith!isAlpha);
       assert(!"ab1".endsWith!(a => a.isAlpha));

       assert("abc".startsWith!isAlpha);
       assert(!"1ab".startsWith!isAlpha);

5. maxCount and maxPos were added.

   Previous to this addition, in order to get the number of the greatest elements, you had to use minCount!"a > b", which was very confusing. This change adds convenience functions to fix this issue.

List of all bug fixes and enhancements in D 2.071.0:

#### DMD Compiler regressions

1. Bugzilla 14965: [REG2.031] Forward reference to inferred return type of function call when using auto return type
2. Bugzilla 14973: [REG2.068] compiler inference of contexts for nested map seems broken
3. Bugzilla 15296: [REG2.069] cannot inline simple function that calls use non-inlinable statements
4. Bugzilla 15422: [REG2.066] associative array of nested struct - crash on usage
5. Bugzilla 15455: [REG v2.065] Compiler segfault for simple nested structure
6. Bugzilla 15618: [REG-master] Class member layout has been changed, ABI needs to be updated?
7. Bugzilla 15713: [REG-master] ctfe string concatenation is templates is broken
8. Bugzilla 15729: [REG(master)] broken debug info for libraries
9. Bugzilla 15733: [REG2.066] Forward reference issue involving inheritance
10. Bugzilla 15744: [REG2.067] (SIGABRT) Error: overloadset t.Bar.__ctor is aliased to a function
11. Bugzilla 15778: [REG2.064] polysemous string type doesn't work in array operation
12. Bugzilla 15781: [REG2.069] Template type deduction failure with same-type variables with different constness
13. Bugzilla 15785: [DMD HEAD] Spurious warning when calling protected super
14. Bugzilla 15788: [REG2.069] ICE assert triggered on overloaded function
15. Bugzilla 15814: [REG-master] Custom deprecation message is not shown
16. Bugzilla 15815: [REG2.071-devel] deprecation for aliased template instance not shown
17. Bugzilla 15817: [REG2.068] ICE (with no stacktrace) instead of 'cannot index null array counts' with CTFE AA
18. Bugzilla 15839: [REG2.071-b1] this.outer is of wrong type

#### DMD Compiler bugs

1. Bugzilla 143: 'package' does not work at all
2. Bugzilla 313: [module] Fully qualified names bypass private imports
3. Bugzilla 314: [module] Static, renamed, and selective imports are always public
4. Bugzilla 1754: module member visibility does not affect conflicts
5. Bugzilla 2991: [module] Import within aggregate causes conflicts with private identifiers
6. Bugzilla 3254: [module] Module member visibility depends on declaration order
7. Bugzilla 6907: ice(interpret.d) delete expressions crash interpreter
8. Bugzilla 7516: Postblit not called for structs returned from a ternary operator
9. Bugzilla 7517: Interface contracts broken
10. Bugzilla 11581: Given T..., new T[0] does not work
11. Bugzilla 12748: ICE: Using typeof(S.init[0]) in type name specialization.
12. Bugzilla 12829: Wrong error line number for closure allocation in @nogc function
13. Bugzilla 13702: One missed 'may cause GC allocation' error message
14. Bugzilla 14442: Wrong this.outer reference in nested classes
15. Bugzilla 14486: delete on classes ignores @nogc
16. Bugzilla 14603: "cannot alias an expression" when opDispatch results in a template
17. Bugzilla 14604: "cannot resolve forward reference" when opDispatch results in a template
18. Bugzilla 14686: Postblit isn't sometimes called on concatenation
19. Bugzilla 14730: Wrong closure var access with -inline
20. Bugzilla 14788: Incorrect rejection of inout function call
21. Bugzilla 14895: ICE on array operation when its result is concatenated
22. Bugzilla 14989: Overload merge sometimes doesn't work
23. Bugzilla 14992: static array local variables always require .init
24. Bugzilla 15309: [dmd-internal] ScopeExp.semantic() should set its type always
25. Bugzilla 15310: [dmd-internal] TemplateDeclaration should be converted to TemplateExp always
26. Bugzilla 15332: ICE in e2ir.c: assert(irs->sthis) in visit(ThisExp), function literal with keyword 'function' calls method
27. Bugzilla 15353: std.experimental.allocator cannot free memory in its destructor if the GC is an ancestor
28. Bugzilla 15384: assignment is sometimes still accepted as a condition
29. Bugzilla 15389: extern(C++) forward referencing problem
30. Bugzilla 15407: Assert hit in toElem e2ir.c:1962
31. Bugzilla 15411: Function literal accessing variable in declaration scope produces bad error message with inline call
32. Bugzilla 15441: dmd segfaults using std.experimental.ndslice
33. Bugzilla 15450: ICE during CTFE of legit function
34. Bugzilla 15519: Circular imports leads to fwd ref error with aliased imports
35. Bugzilla 15535: Emit error on "goto default" in final switch
36. Bugzilla 15565: Forward reference error with namespaces
37. Bugzilla 15578: Should have access to namespace private symbols from same module
38. Bugzilla 15579: extern(C++) interfaces/multiple-inheritance
39. Bugzilla 15610: extern(C++) multiple inheritance - calling with wrong 'this' ptr
40. Bugzilla 15623: is(M!N) evaluates to true for M!N that fails to instantiate.
41. Bugzilla 15626: extern(C++) calling crash
42. Bugzilla 15638: no common type for const classes
43. Bugzilla 15647: Casting from one C++ interface in a hierarchy to another is a noop
44. Bugzilla 15665: Templated scope class with constructor don't compile
45. Bugzilla 15667: dmd infinite loop on invalid syntax.
46. Bugzilla 15669: Wrong line number in error message
47. Bugzilla 15688: dmd segfault with an integer call through comma expression
48. Bugzilla 15784: Overload set constructor call should be supported from inside a constructor
49. Bugzilla 15789: ICE Assert in TemplateInstance semanticTiargs
50. Bugzilla 15794: Lambda cannot get a chance to run its codegen
51. Bugzilla 15811: -transition=import and -transition=checkimport have oddly behaviors
52. Bugzilla 15825: dmd's -transition=checkimports reports a false positive for tuple __dollar

#### DMD Compiler enhancements

1. Bugzilla 10378: Prevent local imports from hiding local symbols
2. Bugzilla 12954: deprecated doesn't work with concatenated strings or anything else but a string literal
3. Bugzilla 14383: [ddoc] documented unittests don't work for module declaration
4. Bugzilla 15644: Change object layout ABI to MI style

#### Phobos regressions

1. Bugzilla 15222: std.experimental omitted from phobos zip file
2. Bugzilla 15782: [Reg 2.071-devel] Alias no longer strips qualifiers from user defined types
3. Bugzilla 15807: Array!bool insertBack is broken

#### Phobos bugs

1. Bugzilla 1238: Private identifiers in imported modules create conflicts with public ones
2. Bugzilla 15543: [ndslice] assumeSameStructure has useless flag
3. Bugzilla 15545: csv Reader line feed '\r' failure
4. Bugzilla 15549: [ndslice] byElement is broken for packed slices
5. Bugzilla 15553: topN very inefficient [slower than sort, even for topN(0)] but should be O(n)
6. Bugzilla 15561: std.typecons.Proxy gets NaN comparisons wrong
7. Bugzilla 15639: std.experimental.allocator enables abstract class instantiation
8. Bugzilla 15654: SysTime.toISOString formats the time zones incorrectly
9. Bugzilla 15655: SysTime.from*String incorrectly accept single digit time zones and minutes > 59
10. Bugzilla 15659: SList: clear() can cause crash
11. Bugzilla 15663: writefln("%#o", 0) should yield "0" instead of "00"
12. Bugzilla 15677: std.experimental.allocators.expandArray overload with init should take the array by ref.
13. Bugzilla 15683: broken link in DDoc
14. Bugzilla 15686: std.uni overloads documentation
15. Bugzilla 15715: [ndslice] rangeHasMutableElements is not defined
16. Bugzilla 15721: free error when calling Mallocator.dispose on interfaces
17. Bugzilla 15772: emplace works with abstract classes but it shouldn't

#### Phobos enhancements

1. Bugzilla 15377: std.stdio: Use MSVCRT's _fseeki64 / _ftelli64 on Windows COFF
2. Bugzilla 15532: [ndslice] iota(5).sliced(2,2) should throw error
3. Bugzilla 15596: strip with delimiter?
4. Bugzilla 15714: [ndslice] byElement seems to be missing some slicing primitives

#### Druntime regressions

1. Bugzilla 15224: making 'clean' results in garbage commands
2. Bugzilla 15779: DWARF EH fails when using stack stomping (-gx)
3. Bugzilla 15822: InvalidMemoryOperationError when calling GC.removeRange/Root from a finalizer

#### Druntime enhancements

1. Bugzilla 15628: Exceptions in fibers never caught with /SAFESEH

#### dlang.org bugs

1. Bugzilla 10987: Add documentation for 'extern (C++)' classes
2. Bugzilla 15344: m32mscoff switch missing from documentation.
3. Bugzilla 15666: Grammar does not allow member function attributes on static constructors
4. Bugzilla 15696: The website logo overlaps the Learn tab when using Microsoft Edge
5. Bugzilla 15697: The script for This Week in D is served over HTTP even when accessing the website over HTTPs.

Copyright © 1999-2019 by the D Language Foundation | Page generated by Ddoc on Tue Jan 15 02:24:00 2019