内容简介:2.093.0 comes with 11 major changes and 58 fixed Bugzilla issues. A huge thanks goes to thewho made 2.093.0 possible.
released Jul 07, 2020
2.093.0 comes with 11 major changes and 58 fixed Bugzilla issues. A huge thanks goes to thewho made 2.093.0 possible.
Compiler changes
- Add new builtin __traits(isCopyable, T) for some type T
- Properly check interface implementations
- Allow initialization of shared variables.
- Add -vtemplates switch to collect and list template statistics
Runtime changes
- add exit_group to core.sys.linux.unistd
- Added module core.sys.darwin.mach.nlist and core.sys.darwin.mach.stab
- Deprecated object.selector
- Memory releated GC options can now be specified with higher accuracy
Installer changes
- The install script now also works on the Windows command prompt.
Dub changes
- Dub root package target environment variables added
- Improved CLI extensibility
Compiler changes
-
Add new builtin __traits(isCopyable, T)
for some type T
Changing Phobos' std.traits.isCopyable to make use of this new builtin trait will reduce memory usage and, in turn, improve the performance of the compiler checking whether a type is copyable or not.
-
Properly check interface implementations
In previous releases the check to verify that a class implements all methods of the interfaces it implements was performed late in the compilation phase. This caused the check to not be performed when code generation was skipped (compiling with the -o- flag).
In this release the check has been moved to an earlier phase of the compilation, causing errors to be reported even when the -o- flag is used. This can cause some breakage if a piece of code has only been compiled with the -o- flag.
The compiler will now properly report an error for the following code when the -o- flag is used:
interface Foo { void foo(); } class Bar : Foo { }
-
Allow initialization of shared variables.
Shared variables can now be initialized when the -preview=nosharedaccess switch is used.
void test() { shared int x; shared int y = 3; }
-
Add -vtemplates switch to collect and list template statistics
Template instantiations can consume lots of time and memory. By passing the -vtemplates switch to the compiler, the compiler will collect and print statistics about template usage in the code being compiled.
For each template that was instantiated, a list of how many times it is instantiated, and how many of those instantiations are unique, is printed.
Runtime changes
-
add exit_group
to core.sys.linux.unistd
add exit_group to core.sys.linux.unistd , exits all threads in a process, present since linux 2.5.35
-
Added module core.sys.darwin.mach.nlist
and core.sys.darwin.mach.stab
Those modules contains bindings for the 64 bits part of Mac OSX's <mach-o/nlish.h> and <mach-o/stab.h> , respectively, and can be used by users wishing to inspect binary data of Mach-O object files.
-
Deprecated object.selector
The public import of selector in the module object has been deprecated. Please explicitly import selector instead using: import core.attribute : selector;
The following code has been deprecated:
extern (Objective-C) extern class NSObject { static NSObject alloc() @selector("alloc"); }
Replace with:
import core.attribute : selector; extern (Objective-C) extern class NSObject { static NSObject alloc() @selector("alloc"); }
-
Memory releated GC options can now be specified with higher accuracy
Memory-related GC options stored in bytes instead of megabytes to provide fine-tune GC on low memory devices.
Added ability to use suffixes B, K, M or G:
extern(C) __gshared string[] rt_options = [ "gcopt=minPoolSize:4K maxPoolSize:2M incPoolSize:8K" ];
Values without suffix treated as megabytes.
Installer changes
-
The install script now also works on the Windows command prompt.
The official D version manager (install.sh, documented at dlang.org/install.html ) used to require a POSIX environment. On Windows, prior to this release, this meant running the script and the compilers that it installed from within a POSIX terminal emulator as provided by MSYS2 or Cygwin. With this release it is now possible to install and activate compilers from the Windows command prompt directly.
Assuming an MSYS2 installation is present in C:\msys64 , necessary decompression tools can be installed from the Windows command prompt:
C:\msys64\usr\bin\pacman.exe --sync unzip p7zip
The following will invoke the script directly from dlang.org and install the latest dmd compiler in the %USERPROFILE%\dlang folder:
C:\msys64\usr\bin\curl.exe https://dlang.org/install.sh | \msys64\usr\bin\bash.exe -s
This process will end with a message showing the location of activate.bat , which can be used to add the installed compiler to your PATH .
The script itself will also be installed locally. This will show you its other uses:
C:\msys64\usr\bin\bash.exe %USERPROFILE%\dlang\install.sh --help
Dub changes
-
Dub root package target environment variables added
Environment variables DUB_ROOT_PACKAGE_TARGET_TYPE , DUB_ROOT_PACKAGE_TARGET_PATH and DUB_ROOT_PACKAGE_TARGET_NAME have been added and exposed.
-
Improved CLI extensibility
The code from the runDubCommandLine was moved to some other structs. The new CommandLineHandler structure takes care of the CLI state and commands, which allows DUB commands to be extended in other projects.
The CommandArgs class now has new hasAppArgs and appArgs methods which allows you to get the app arguments. In addition, the extractAllRemainingArgs method will return all unused arguments and the app arguments.
DMD Compiler regressions
- Bugzilla 19550: [REG 2.078] Massive compiler backend slowdown
- Bugzilla 20014: [REG 2.084] -transition=all, -preview=all, -revert=all is invalid
- Bugzilla 20833: Template members prevent __traits(getOverloads) from working properly
DMD Compiler bugs
- Bugzilla 11292: Cannot re-initialize a const field in postblit
- Bugzilla 12504: Wrong 'cannot cover index range' error message
- Bugzilla 15235: inline asm: silent ICE (segfault) in asm_add_exp()
- Bugzilla 16971: Misleading error messages "break is not inside scope(exit) bodies" "continue is not inside scope(exit) bodies"
- Bugzilla 20183: Assigning statement scope of struct literal or temporary to variable with longer lifetime
- Bugzilla 20410: ReplaceTypeUnless replaces enums with their basetype
- Bugzilla 20709: Segmentation fault when importing nonexistent type
- Bugzilla 20719: Self referential struct definition causes stack overflow
- Bugzilla 20747: @live tracking of non-pointer owners not done
- Bugzilla 20771: va_arg doesn't work for structs with postblits
- Bugzilla 20772: va_arg doesn't work for structs with copy constructors
- Bugzilla 20775: Missing fail compilation test for passing types that need destruction
- Bugzilla 20780: Function parameter UDA not accepted in nested function declarations
- Bugzilla 20789: is(T: U) doesn't exclude deprecated alias calls with -de
- Bugzilla 20800: Error: cannot implicitly convert expression with bad diagnostic.
- Bugzilla 20824: error messages generated by dmd build script can be prefixed with a non-standard "ERROR:"
- Bugzilla 20825: the filename of the error messages generated by dmd build.d script miss the "src/" part of the path
- Bugzilla 20840: No deprecation when using template from deprecated selective import
- Bugzilla 20842: Structs with disabled default/copy ctors can't be initialized
- Bugzilla 20861: Interface implementations are not checked when code gen is skipped
- Bugzilla 20903: seg fault on long signed divide overflow
- Bugzilla 20906: unnecessary divide-by-zero errors when constant folding short circuits
- Bugzilla 20909: .offsetof fails on forward reference of field
- Bugzilla 20915: __traits(allMembers) results include custom version identifiers, which is unusable
- Bugzilla 20923: Redefinition of 'size_t' is affecting TypeStruct functions
- Bugzilla 20989: Checking array.ptr causes safety error with -checkaction=context
DMD Compiler enhancements
-
Bugzilla 20791: extern(C++
) should allow a trailing comma - Bugzilla 20796: protection attribute package(x.y) does not bind to one of ancestor packages of module x.y when declared in x/y/package.d
Phobos regressions
- Bugzilla 20943: std.algorithm.setops.cartesianProduct fails for ranges with @system popFront
Phobos bugs
- Bugzilla 9298: some std.math functions not implemented for Win64
- Bugzilla 20426: doesPointTo with void[N] fails
- Bugzilla 20751: SortedRange with ref predicate parameters fails
- Bugzilla 20782: std.conv.to can't convert string to const enum
- Bugzilla 20783: std.string.lastIndexOf doesn't work correctly in CTFE
- Bugzilla 20836: std.math: reorder declarations from most visible to least
- Bugzilla 20850: Can't assign enum of Tuple
- Bugzilla 20874: std.json.assign requires '@safe' and 'pure'
- Bugzilla 20928: Overloaded opIndex confuses MapResult
Phobos enhancements
- Bugzilla 19525: Duration is not usable with zero-arg std.algorithm.sum
- Bugzilla 20496: chunkby should support ref predicates
- Bugzilla 20869 : std.algorithm.mutation : move is overly trusting of opPostMove
- Bugzilla 20887: Improve speed of std.digest.digest!(Hash, Range) on non-array ranges
Druntime bugs
- Bugzilla 18011: core.sys.condition cannot be used as shared
- Bugzilla 20760: checkaction=context doesnt print floating point numbers correctly
- Bugzilla 20763: checkaction=context does not format pointers
- Bugzilla 20767: [DIP1014] __move_post_blt must only recursively call itself on a struct's fields not all members
- Bugzilla 20768: [DIP1014] __move_post_blt must recursively call itself on static arrays whose elements are structs or static arrays that recursively contain structs
- Bugzilla 20852: core.sys.posix.sys.wait missing definitions on FreeBSD
Druntime enhancements
- Bugzilla 20746: Change LCG in garbage collector treap to use full 64 bits of state instead of 48
- Bugzilla 20787: Add module core.sys.darwin.sys.attr with getattrlist, setattrlist, searchfs, and related definitions
- Bugzilla 20844: DMD compiler should take care of data alignment, after seeing the 'cas' call
- Bugzilla 20859: Add overloads of core.sync.rwmutex.ReadWriteMutex.Reader/Writer.tryLock that take a timeout duration
dlang.org enhancements
- Bugzilla 20882: Outdated examples in the documentation (std.stdio)
Tools enhancements
- Bugzilla 13345: rdmd --eval doesn't support args
Installer bugs
- Bugzilla 20826: CI breakage: create_dmd_release attempts to copy the complete dmd repo.
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。