@@ -5,7 +5,7 @@ $(CHANGELOG_NAV_INJECT)
55$(VERSION Apr 01, 2024, =================================================,
66
77$(CHANGELOG_HEADER_STATISTICS
8- $(VER) comes with 7 major changes and 48 fixed Bugzilla issues.
8+ $(VER) comes with 8 major changes and 33 fixed Bugzilla issues.
99 A huge thanks goes to the
1010 $(LINK2 #contributors, 35 contributors)
1111 who made $(VER) possible.)
@@ -14,8 +14,9 @@ $(BUGSTITLE_TEXT_HEADER Compiler changes,
1414
1515$(LI $(RELATIVE_LINK2 dmd.classinfo,Added .nameSig field to TypeInfo_Class in object.d))
1616$(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))
17+ $(LI $(RELATIVE_LINK2 dmd.hexstring-cast,Hex strings now convert to integer arrays))
1818$(LI $(RELATIVE_LINK2 dmd.ies,Add support for Interpolated Expression Sequences))
19+ $(LI $(RELATIVE_LINK2 dmd.named-arguments,Named arguments for functions have been implemented and documented))
1920
2021)
2122
@@ -102,30 +103,30 @@ void func3(Loc loc = defaultLoc)
102103---
103104)
104105
105- $(LI $(LNAME2 dmd.hexstring-cast,Hex strings can now be cast to integer arrays)
106+ $(LI $(LNAME2 dmd.hexstring-cast,Hex strings now convert to integer arrays)
106107$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.hexstring-cast.dd)
107108$(P
108109Hex strings are the most efficient way to embed binary data into source files.
109110However, 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+ Now, hex strings implicitly convert to all integer arrays.
111112A big endian byte order is assumed, consistent with how integer literals are written.
112113)
113114
114115---
115- immutable uint[] data = cast(immutable uint[]) x"AABBCCDD";
116+ immutable uint[] data = x"AABBCCDD";
116117
117118static assert(data[0] == 0xAABBCCDD);
118119---
119120
120121$(P
121- Character postfixes can now also be used for integers of size 2 or 4:
122+ Character postfixes can now also be used to explicitly set an element size of 2 or 4.
122123)
124+
123125---
124126immutable ushort[] f = x"80 3F"w;
125127static assert(f[0] == 0x803F);
126128
127- immutable int[] f = x"80 35 FF FD"d;
128- static assert(f[0] == 0x803FFF);
129+ immutable ubyte[] g = x"80 35"w; // error: size mismatch
129130---
130131
131132$(P
@@ -167,6 +168,59 @@ You can also pass them to other functions which understand the types in the new
167168)
168169)
169170
171+ $(LI $(LNAME2 dmd.named-arguments,Named arguments for functions have been implemented and documented)
172+ $(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.named-arguments.dd)
173+ $(P
174+ When calling a function, arguments may be preceded with a parameter name for purposes of clarity and flexible ordering.
175+ Consequently, default arguments need not be at the end of the parameter list anymore.
176+ )
177+
178+ ---
179+ void createWindow(bool fullScreen = false, int width, int height, string title);
180+
181+ void main()
182+ {
183+ createWindow(title: "Skynet", width: 1280, height: 720);
184+ }
185+ ---
186+
187+ $(P
188+ Named arguments can also be used in struct/union literals.
189+ A union can now be initialized by setting a field different than the first one.
190+ )
191+
192+ ---
193+ union U
194+ {
195+ float asFloat;
196+ uint asInt;
197+ }
198+
199+ auto u0 = U(1.0); // this sets the `asFloat` field
200+ auto u1 = U(asInt: 0x3F800000); // formerly not possible
201+ ---
202+
203+ $(P
204+ Relevant specification pages are:
205+ $(UL
206+ $(LI $(DDSUBLINK spec/struct, struct-literal, Struct Literals))
207+ $(LI $(DDSUBLINK spec/struct, anonymous, Anonymous Structs and Unions))
208+ $(LI $(DDSUBLINK spec/expression, argument-parameter-matching, Matching Arguments to Parameters))
209+ $(LI $(DDSUBLINK spec/function, function-overloading, Function Overloading))
210+ )
211+ )
212+
213+ $(P
214+ Note that the implementation for regular functions and struct literals has been around since dmd 2.103, but it was undocumented and wouldn't work with template functions.
215+ )
216+
217+ $(P
218+ This implements [DIP1030](https://www.dlang.org/dips/1030) for *function arguments*, but named *template arguments* are not implemented yet.
219+ Also, there are still implementation details to be ironed out which the DIP doesn't specify, such as how named arguments interact with tuples.
220+ For more information, see: [Named Arguments Status Update](https://forum.dlang.org/post/bynneksajyfyadwndsbm@forum.dlang.org)
221+ )
222+ )
223+
170224
171225)
172226
@@ -273,37 +327,22 @@ $(CHANGELOG_SEP_TEXT_BUGZILLA)
273327
274328$(BUGSTITLE_BUGZILLA DMD Compiler regression fixes,
275329
276- $(LI $(BUGZILLA 20802): [REG2.088.0] Link failure with writefln)
277330$(LI $(BUGZILLA 24179): Ddoc broke D code sections)
278331$(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)
280332)
281333$(BUGSTITLE_BUGZILLA DMD Compiler bug fixes,
282334
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)
286335$(LI $(BUGZILLA 23515): Named Enum of function SIGSEGFAULT)
287- $(LI $(BUGZILLA 23517): dmd with -g flag fails to link on macOS with unaligned pointer)
288336$(LI $(BUGZILLA 23786): __traits$(LPAREN)parent, {}$(RPAREN) in overloaded function produces wierd results dependent on declaration order)
289337$(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)
291338$(LI $(BUGZILLA 24293): ImportC: C preprocessor output should use temporary files)
292339$(LI $(BUGZILLA 24309): Memory allocation failed on Azure pipeline)
293340$(LI $(BUGZILLA 24359): slice equality expression can be discarded)
294341$(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)
297342$(LI $(BUGZILLA 24383): Index assignment expression in __traits$(LPAREN)compiles$(RPAREN) fails to parse)
298343$(LI $(BUGZILLA 24387): Base class construction ignores private)
299344$(LI $(BUGZILLA 24389): importC: Building zlib in Phobos with importC fails on FreeBSD 14)
300345$(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)
307346)
308347$(BUGSTITLE_BUGZILLA DMD Compiler enhancements,
309348
0 commit comments