|
| 1 | +Ddoc |
| 2 | + |
| 3 | +$(CHANGELOG_NAV_INJECT) |
| 4 | + |
| 5 | +$(VERSION Apr 01, 2024, =================================================, |
| 6 | + |
| 7 | +$(CHANGELOG_HEADER_STATISTICS |
| 8 | +$(VER) comes with 7 major changes and 48 fixed Bugzilla issues. |
| 9 | + A huge thanks goes to the |
| 10 | + $(LINK2 #contributors, 35 contributors) |
| 11 | + who made $(VER) possible.) |
| 12 | + |
| 13 | +$(BUGSTITLE_TEXT_HEADER Compiler changes, |
| 14 | + |
| 15 | +$(LI $(RELATIVE_LINK2 dmd.classinfo,Added .nameSig field to TypeInfo_Class in object.d)) |
| 16 | +$(LI $(RELATIVE_LINK2 dmd.default-init,Keywords like `__FILE__` are always evaluated at the call site)) |
| 17 | +$(LI $(RELATIVE_LINK2 dmd.hexstring-cast,Hex strings can now be cast to integer arrays)) |
| 18 | +$(LI $(RELATIVE_LINK2 dmd.ies,Add support for Interpolated Expression Sequences)) |
| 19 | + |
| 20 | +) |
| 21 | + |
| 22 | +$(BUGSTITLE_TEXT_HEADER Library changes, |
| 23 | + |
| 24 | +$(LI $(RELATIVE_LINK2 range_predicate_element,`isForwardRange`, `isBidirectionalRange`, and `isRandomAccessRange` now take an optional element type)) |
| 25 | +$(LI $(RELATIVE_LINK2 upgrade-unicode,std.uni has been upgraded from Unicode 15.0.0 to 15.1.0)) |
| 26 | + |
| 27 | +) |
| 28 | + |
| 29 | +$(BUGSTITLE_TEXT_HEADER Dub changes, |
| 30 | + |
| 31 | +$(LI $(RELATIVE_LINK2 dub-fetch,The fetch command now supports multiple arguments, recursive fetch, and is project-aware)) |
| 32 | + |
| 33 | +) |
| 34 | + |
| 35 | +$(CHANGELOG_SEP_HEADER_TEXT_NONEMPTY) |
| 36 | + |
| 37 | +$(CHANGELOG_SEP_HEADER_TEXT) |
| 38 | + |
| 39 | +$(BUGSTITLE_TEXT_BODY Compiler changes, |
| 40 | + |
| 41 | +$(LI $(LNAME2 dmd.classinfo,Added .nameSig field to TypeInfo_Class in object.d) |
| 42 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.classinfo.dd) |
| 43 | +$(P |
| 44 | +This is a 16 byte md5 signature of the fully qualified name of the class. |
| 45 | +It is used to compare two classes for equality, rather than comparing the |
| 46 | +pointers with a fallback to doing a string compare on the name, which can |
| 47 | +be rather slow. |
| 48 | +) |
| 49 | + |
| 50 | +$(P |
| 51 | +The result is both druntime and phobos will need to be recompiled to be |
| 52 | +compatible with this change. Any libraries will need to be recompiled |
| 53 | +as well. |
| 54 | +) |
| 55 | +) |
| 56 | + |
| 57 | +$(LI $(LNAME2 dmd.default-init,Keywords like `__FILE__` are always evaluated at the call site) |
| 58 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.default-init.dd) |
| 59 | +$(P |
| 60 | +Default arguments for functions can contain the keywords `__FILE__`, |
| 61 | +`__FILE_FULL_PATH__`, `__MODULE__`, `__LINE__`, `__FUNCTION__` |
| 62 | +and `__PRETTY_FUNCTION__`. They are now evaluated at the source location |
| 63 | +of the calling function in more complex expressions as long as used in |
| 64 | +an initializer, directly or not. Previously they had to be used directly |
| 65 | +in the initializer to be evaluated at the call site. Here are some |
| 66 | +examples, where more complex initializers are now evaluated at the |
| 67 | +call site: |
| 68 | +) |
| 69 | + |
| 70 | +--- |
| 71 | +void func1(const(char)* file = __FILE__.ptr, size_t line = __LINE__) |
| 72 | +{ |
| 73 | + // This now prints the filename of the calling function. |
| 74 | + // Previously it was the filename of func1 itself. |
| 75 | + printf("%s:%zd\n", file, line); |
| 76 | +} |
| 77 | + |
| 78 | +struct Loc |
| 79 | +{ |
| 80 | + string file; |
| 81 | + size_t line; |
| 82 | +} |
| 83 | + |
| 84 | +void func2(Loc loc = Loc(__FILE__, __LINE__)) |
| 85 | +{ |
| 86 | + // Variable loc now contains file and line of the calling function. |
| 87 | + // Previously it was the location of func2. |
| 88 | + writeln(loc.file, ":", loc.line); |
| 89 | +} |
| 90 | + |
| 91 | +Loc defaultLoc(string file = __FILE__, size_t line = __LINE__) |
| 92 | +{ |
| 93 | + return Loc(file, line); |
| 94 | +} |
| 95 | + |
| 96 | +void func3(Loc loc = defaultLoc) |
| 97 | +{ |
| 98 | + // Variable loc contains file and line of the calling function of |
| 99 | + // func3 and not the location of func3 or defaultLoc. |
| 100 | + writeln(loc.file, ":", loc.line); |
| 101 | +} |
| 102 | +--- |
| 103 | +) |
| 104 | + |
| 105 | +$(LI $(LNAME2 dmd.hexstring-cast,Hex strings can now be cast to integer arrays) |
| 106 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.hexstring-cast.dd) |
| 107 | +$(P |
| 108 | +Hex strings are the most efficient way to embed binary data into source files. |
| 109 | +However, they couldn't easily be used to initialize a `short[]`, `int[]` or `long[]` because re-interpret casting arrays is not allowed during CTFE. |
| 110 | +Now, hex strings can be cast to integer arrays with element types larger than `byte`. |
| 111 | +A big endian byte order is assumed, consistent with how integer literals are written. |
| 112 | +) |
| 113 | + |
| 114 | +--- |
| 115 | +immutable uint[] data = cast(immutable uint[]) x"AABBCCDD"; |
| 116 | + |
| 117 | +static assert(data[0] == 0xAABBCCDD); |
| 118 | +--- |
| 119 | + |
| 120 | +$(P |
| 121 | +Character postfixes can now also be used for integers of size 2 or 4: |
| 122 | +) |
| 123 | +--- |
| 124 | +immutable ushort[] f = x"80 3F"w; |
| 125 | +static assert(f[0] == 0x803F); |
| 126 | + |
| 127 | +immutable int[] f = x"80 35 FF FD"d; |
| 128 | +static assert(f[0] == 0x803FFF); |
| 129 | +--- |
| 130 | + |
| 131 | +$(P |
| 132 | +Formerly, they would pad each byte with 1 or 3 zeros, which did not serve a purpose (See [Issue 24363](https://issues.dlang.org/show_bug.cgi?id=24363)). |
| 133 | +) |
| 134 | + |
| 135 | +$(P |
| 136 | +If the string's byte length is not a multiple of the target element size, it is an error: |
| 137 | +) |
| 138 | + |
| 139 | +--- |
| 140 | +immutable ushort[] e = x"AABBCC"w; // Error, 3 bytes is not a multiple of `ushort.sizeof` |
| 141 | +--- |
| 142 | +) |
| 143 | + |
| 144 | +$(LI $(LNAME2 dmd.ies,Add support for Interpolated Expression Sequences) |
| 145 | +$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.ies.dd) |
| 146 | +$(P |
| 147 | +Interpolated Expression Sequences are a way to implement things like string interpolation in library code. Three forms of literals are added: |
| 148 | +) |
| 149 | + |
| 150 | +``` |
| 151 | +i"Content $(a + 4)" |
| 152 | +i`Content $(a + 4)` |
| 153 | +iq{Content $(a + 4)} |
| 154 | +``` |
| 155 | + |
| 156 | +$(P |
| 157 | +all provide the same thing: a tuple that can be passed to other functions, like `writeln` from `std.stdio` and `text` from `std.conv`: |
| 158 | +) |
| 159 | + |
| 160 | +``` |
| 161 | +int a = 6; |
| 162 | +writeln(i"Content $(a + 4)"); // prints "Content 10" |
| 163 | +``` |
| 164 | + |
| 165 | +$(P |
| 166 | +You can also pass them to other functions which understand the types in the new `core.interpolation` module. Numerous examples can be found documentation of that module or in this repository: https://github.com/adamdruppe/interpolation-examples/ |
| 167 | +) |
| 168 | +) |
| 169 | + |
| 170 | + |
| 171 | +) |
| 172 | + |
| 173 | +$(BUGSTITLE_TEXT_BODY Library changes, |
| 174 | + |
| 175 | +$(LI $(LNAME2 range_predicate_element,`isForwardRange`, `isBidirectionalRange`, and `isRandomAccessRange` now take an optional element type) |
| 176 | +$(CHANGELOG_SOURCE_FILE phobos, changelog/range_predicate_element.dd) |
| 177 | +$(P |
| 178 | +In Phobos 2.106, an optional second template parameter was added to |
| 179 | +`isInputRange` to enable conveniently checking a range's element type. Now, the |
| 180 | +same parameter has been added to `isForwardRange`, `isBidirectionalRange`, and |
| 181 | +`isRandomAccessRange`. |
| 182 | +) |
| 183 | + |
| 184 | +$(P |
| 185 | +As before, if a second type argument is passed to one of these templates, the |
| 186 | +range's element type is checked to see if it is |
| 187 | +$(DDSUBLINK spec/const3, implicit_qualifier_conversions, qualifier-convertible) |
| 188 | +to the given type, and this additional check must pass in order for the |
| 189 | +template to evaluate to `true`. |
| 190 | +) |
| 191 | + |
| 192 | +$(P |
| 193 | +Examples: |
| 194 | +) |
| 195 | +--- |
| 196 | +// exact match |
| 197 | +static assert( isForwardRange!(int[], int)); |
| 198 | + |
| 199 | +// match with qualifier conversion |
| 200 | +static assert( isBidirectionalRange!(int[], const(int)); |
| 201 | + |
| 202 | +// not a match |
| 203 | +static assert(!isRandomAccessRange!(int[], string)); |
| 204 | +--- |
| 205 | +) |
| 206 | + |
| 207 | +$(LI $(LNAME2 upgrade-unicode,std.uni has been upgraded from Unicode 15.0.0 to 15.1.0) |
| 208 | +$(CHANGELOG_SOURCE_FILE phobos, changelog/upgrade-unicode.dd) |
| 209 | +$(P |
| 210 | +This Unicode update was released September 12, 2023. |
| 211 | +See: https://www.unicode.org/versions/Unicode15.1.0/ |
| 212 | +) |
| 213 | + |
| 214 | +``` |
| 215 | +import std; |
| 216 | + |
| 217 | +void main() |
| 218 | +{ |
| 219 | + const alphaCount = iota(0, dchar.max).filter!(std.uni.isAlpha).walkLength; |
| 220 | + writeln(alphaCount); |
| 221 | + // formerly: 137765 |
| 222 | + // now: 138387 |
| 223 | + // 622 new dchars return true for `isAlpha` |
| 224 | +} |
| 225 | +``` |
| 226 | + |
| 227 | +$(P |
| 228 | +The internal unicode tables (std/internal/unicode_tables.d) have also been changed to use hex strings instead of array literals, which makes them faster to import. |
| 229 | +The exact speed up depends on your computer and D compiler, but it likely cuts between 30 and 100 milliseconds if you compile something which imports `std.string` or `std.uni`. |
| 230 | +) |
| 231 | +) |
| 232 | + |
| 233 | + |
| 234 | +) |
| 235 | + |
| 236 | +$(BUGSTITLE_TEXT_BODY Dub changes, |
| 237 | + |
| 238 | +$(LI $(LNAME2 dub-fetch,The fetch command now supports multiple arguments, recursive fetch, and is project-aware) |
| 239 | +$(CHANGELOG_SOURCE_FILE dub, changelog/dub-fetch.dd) |
| 240 | +$(P |
| 241 | +Previously, `dub fetch` could only fetch a single package, |
| 242 | +and was working independently of the working directory. |
| 243 | +) |
| 244 | + |
| 245 | +$(P |
| 246 | +With this release, support for multiple packages have |
| 247 | +been added, such that the following is now possible: |
| 248 | +) |
| 249 | +--- |
| 250 | +$ dub fetch vibe-d@0.9.0 vibe-d@0.9.1 vibe-d@0.9.2 |
| 251 | +--- |
| 252 | + |
| 253 | +$(P |
| 254 | +When called with no argument, `dub fetch` used to error out. |
| 255 | +However, it will now attempt to fetch dependencies for the |
| 256 | +current project, if any exists. |
| 257 | +) |
| 258 | + |
| 259 | +$(P |
| 260 | +Finally, when fetching a package, it might be useful to fetch |
| 261 | +all its dependencies. This is done automatically for projects, |
| 262 | +and can now be done for direct fetch as well: |
| 263 | +) |
| 264 | +--- |
| 265 | +$ dub fetch --recursive vibe-d@0.9.0 vibe-d@0.9.1 |
| 266 | +--- |
| 267 | +) |
| 268 | + |
| 269 | + |
| 270 | +) |
| 271 | + |
| 272 | +$(CHANGELOG_SEP_TEXT_BUGZILLA) |
| 273 | + |
| 274 | +$(BUGSTITLE_BUGZILLA DMD Compiler regression fixes, |
| 275 | + |
| 276 | +$(LI $(BUGZILLA 20802): [REG2.088.0] Link failure with writefln) |
| 277 | +$(LI $(BUGZILLA 24179): Ddoc broke D code sections) |
| 278 | +$(LI $(BUGZILLA 24315): dmd/cpreprocess.d:87: warning: use of tmpnam is dangerous use mkstemp) |
| 279 | +$(LI $(BUGZILLA 24371): [REG 2.104] String array concatenation does not respect operator precedence) |
| 280 | +) |
| 281 | +$(BUGSTITLE_BUGZILLA DMD Compiler bug fixes, |
| 282 | + |
| 283 | +$(LI $(BUGZILLA 20297): ld: warning: no platform load command found for macOS) |
| 284 | +$(LI $(BUGZILLA 21047): Linker error: GOT load reloc does not point to a movq instruction) |
| 285 | +$(LI $(BUGZILLA 22556): Invalid GOT load reloc with -O on MacOS) |
| 286 | +$(LI $(BUGZILLA 23515): Named Enum of function SIGSEGFAULT) |
| 287 | +$(LI $(BUGZILLA 23517): dmd with -g flag fails to link on macOS with unaligned pointer) |
| 288 | +$(LI $(BUGZILLA 23786): __traits$(LPAREN)parent, {}$(RPAREN) in overloaded function produces wierd results dependent on declaration order) |
| 289 | +$(LI $(BUGZILLA 23818): Error HMODULE not defined, please use HMODULE) |
| 290 | +$(LI $(BUGZILLA 24137): Link failure on macOS with symbol count from symbol table and dynamic symbol table differ) |
| 291 | +$(LI $(BUGZILLA 24293): ImportC: C preprocessor output should use temporary files) |
| 292 | +$(LI $(BUGZILLA 24309): Memory allocation failed on Azure pipeline) |
| 293 | +$(LI $(BUGZILLA 24359): slice equality expression can be discarded) |
| 294 | +$(LI $(BUGZILLA 24363): hex string postfixes are useless) |
| 295 | +$(LI $(BUGZILLA 24365): ICE when printing 'showCtfeContext' error) |
| 296 | +$(LI $(BUGZILLA 24370): static array values in static AA initialise to dynamic arrays) |
| 297 | +$(LI $(BUGZILLA 24383): Index assignment expression in __traits$(LPAREN)compiles$(RPAREN) fails to parse) |
| 298 | +$(LI $(BUGZILLA 24387): Base class construction ignores private) |
| 299 | +$(LI $(BUGZILLA 24389): importC: Building zlib in Phobos with importC fails on FreeBSD 14) |
| 300 | +$(LI $(BUGZILLA 24390): AssertError@src/dmd/backend/cgxmm.d$(LPAREN)1476$(RPAREN): Assertion failure) |
| 301 | +$(LI $(BUGZILLA 24399): Link failure on MacOS with address=0x0 points to section$(LPAREN)2$(RPAREN) with no content in config_a68_4c3.o) |
| 302 | +$(LI $(BUGZILLA 24401): OSX: Linker error: GOT load reloc does not point to a movq instruction) |
| 303 | +$(LI $(BUGZILLA 24402): OSX: Linker warning: pointer not aligned at __OBJC_PROTOCOL_$_Foo) |
| 304 | +$(LI $(BUGZILLA 24407): OSX: ld: Assertion failed: $(LPAREN)slot < _sideTableBuffer.size$(LPAREN)$(RPAREN)$(RPAREN), function addAtom) |
| 305 | +$(LI $(BUGZILLA 24409): DMD crash for CTFE in stompOverlappedFields) |
| 306 | +$(LI $(BUGZILLA 24422): ImportC: ICE: Segfault in cparseFunctionDefinition) |
| 307 | +) |
| 308 | +$(BUGSTITLE_BUGZILLA DMD Compiler enhancements, |
| 309 | + |
| 310 | +$(LI $(BUGZILLA 3543): [tdpl] ternary operator can't find common type for classes/interfaces) |
| 311 | +$(LI $(BUGZILLA 18919): __FILE__ and __LINE__ should work when used in default argument expressions) |
| 312 | +$(LI $(BUGZILLA 24316): Allow CTFE access to immutable variable through pointer) |
| 313 | +$(LI $(BUGZILLA 24397): Support C preprocessor function-like macros) |
| 314 | +) |
| 315 | +$(BUGSTITLE_BUGZILLA Phobos bug fixes, |
| 316 | + |
| 317 | +$(LI $(BUGZILLA 24339): std.mmfile has poor documentation) |
| 318 | +$(LI $(BUGZILLA 24348): Inaccurate documentation for hasSlicing with infinite range) |
| 319 | +$(LI $(BUGZILLA 24384): roundRobin crashes with empty first argument) |
| 320 | +$(LI $(BUGZILLA 24403): Nullable doesn't work with non-mutable types with a destructor) |
| 321 | +) |
| 322 | +$(BUGSTITLE_BUGZILLA Phobos enhancements, |
| 323 | + |
| 324 | +$(LI $(BUGZILLA 24318): Nullable should support non-copyable objects) |
| 325 | +$(LI $(BUGZILLA 24382): std.range.only should have assignable elements) |
| 326 | +) |
| 327 | +$(BUGSTITLE_BUGZILLA Druntime bug fixes, |
| 328 | + |
| 329 | +$(LI $(BUGZILLA 4071): Missing support to share memory and objects between DLLs and executable) |
| 330 | +$(LI $(BUGZILLA 24349): object noreturn link is missing) |
| 331 | +$(LI $(BUGZILLA 24404): The names of the union fields in Linux's ifaddrs are named incorrectly.) |
| 332 | +$(LI $(BUGZILLA 24405): FreeBSD's ifaddrs missing the ifa_broadaddr field) |
| 333 | +$(LI $(BUGZILLA 24408): AF_INET6 duplicated in core.sys.linux.sys.socket) |
| 334 | +$(LI $(BUGZILLA 24417): core.sys.posix.sys.select: fds_bits named __fds_bits on FreeBSD) |
| 335 | +) |
| 336 | +$(BUGSTITLE_BUGZILLA Druntime enhancements, |
| 337 | + |
| 338 | +$(LI $(BUGZILLA 15504): core.demangle uses exception handling for normal control flow) |
| 339 | +$(LI $(BUGZILLA 19702): Remove usage of DECLARE_HANDLE) |
| 340 | +) |
| 341 | +$(BUGSTITLE_BUGZILLA dlang.org enhancements, |
| 342 | + |
| 343 | +$(LI $(BUGZILLA 24313): Download page should reference Github nightlies) |
| 344 | +$(LI $(BUGZILLA 24331): @nogc and GC.disable$(LPAREN)$(RPAREN) are often confused) |
| 345 | +) |
| 346 | +) |
| 347 | +$(D_CONTRIBUTORS_HEADER 35) |
| 348 | +$(D_CONTRIBUTORS |
| 349 | + $(D_CONTRIBUTOR Adam D. Ruppe) |
| 350 | + $(D_CONTRIBUTOR Adam Wilson) |
| 351 | + $(D_CONTRIBUTOR Atila Neves) |
| 352 | + $(D_CONTRIBUTOR Bastiaan Veelo) |
| 353 | + $(D_CONTRIBUTOR Denis Feklushkin) |
| 354 | + $(D_CONTRIBUTOR Dennis) |
| 355 | + $(D_CONTRIBUTOR Dennis Korpel) |
| 356 | + $(D_CONTRIBUTOR dkorpel) |
| 357 | + $(D_CONTRIBUTOR Hiroki Noda) |
| 358 | + $(D_CONTRIBUTOR Iain Buclaw) |
| 359 | + $(D_CONTRIBUTOR Jeremy) |
| 360 | + $(D_CONTRIBUTOR Johan Engelen) |
| 361 | + $(D_CONTRIBUTOR Johannes) |
| 362 | + $(D_CONTRIBUTOR Jonathan M Davis) |
| 363 | + $(D_CONTRIBUTOR kt) |
| 364 | + $(D_CONTRIBUTOR Mai-Lapyst) |
| 365 | + $(D_CONTRIBUTOR Martin Kinkelin) |
| 366 | + $(D_CONTRIBUTOR Mathis Beer) |
| 367 | + $(D_CONTRIBUTOR Max Haughton) |
| 368 | + $(D_CONTRIBUTOR Nicholas Wilson) |
| 369 | + $(D_CONTRIBUTOR Nick Treleaven) |
| 370 | + $(D_CONTRIBUTOR Ogi-kun) |
| 371 | + $(D_CONTRIBUTOR Paul Backus) |
| 372 | + $(D_CONTRIBUTOR Puneet Goel) |
| 373 | + $(D_CONTRIBUTOR Rainer Schuetze) |
| 374 | + $(D_CONTRIBUTOR Razvan Nitu) |
| 375 | + $(D_CONTRIBUTOR Richard (Rikki) Andrew Cattermole) |
| 376 | + $(D_CONTRIBUTOR ryuukk) |
| 377 | + $(D_CONTRIBUTOR Spoov) |
| 378 | + $(D_CONTRIBUTOR Steven Schveighoffer) |
| 379 | + $(D_CONTRIBUTOR Teodor Dutu) |
| 380 | + $(D_CONTRIBUTOR Tim Schendekehl) |
| 381 | + $(D_CONTRIBUTOR vabenil) |
| 382 | + $(D_CONTRIBUTOR Vladimir Panteleev) |
| 383 | + $(D_CONTRIBUTOR Walter Bright) |
| 384 | +) |
| 385 | +$(D_CONTRIBUTORS_FOOTER) |
| 386 | +$(CHANGELOG_NAV_INJECT) |
| 387 | + |
| 388 | +Macros: |
| 389 | + VER=2.108.0 |
| 390 | + TITLE=Change Log: $(VER) |
0 commit comments