@@ -5,7 +5,7 @@ $(CHANGELOG_NAV_INJECT)
5
5
$(VERSION Apr 01, 2024, =================================================,
6
6
7
7
$(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.
9
9
A huge thanks goes to the
10
10
$(LINK2 #contributors, 35 contributors)
11
11
who made $(VER) possible.)
@@ -14,8 +14,9 @@ $(BUGSTITLE_TEXT_HEADER Compiler changes,
14
14
15
15
$(LI $(RELATIVE_LINK2 dmd.classinfo,Added .nameSig field to TypeInfo_Class in object.d))
16
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))
17
+ $(LI $(RELATIVE_LINK2 dmd.hexstring-cast,Hex strings now convert to integer arrays))
18
18
$(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))
19
20
20
21
)
21
22
@@ -102,30 +103,30 @@ void func3(Loc loc = defaultLoc)
102
103
---
103
104
)
104
105
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)
106
107
$(CHANGELOG_SOURCE_FILE dmd, changelog/dmd.hexstring-cast.dd)
107
108
$(P
108
109
Hex strings are the most efficient way to embed binary data into source files.
109
110
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
+ Now, hex strings implicitly convert to all integer arrays.
111
112
A big endian byte order is assumed, consistent with how integer literals are written.
112
113
)
113
114
114
115
---
115
- immutable uint[] data = cast(immutable uint[]) x"AABBCCDD";
116
+ immutable uint[] data = x"AABBCCDD";
116
117
117
118
static assert(data[0] == 0xAABBCCDD);
118
119
---
119
120
120
121
$(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.
122
123
)
124
+
123
125
---
124
126
immutable ushort[] f = x"80 3F"w;
125
127
static assert(f[0] == 0x803F);
126
128
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
129
130
---
130
131
131
132
$(P
@@ -167,6 +168,59 @@ You can also pass them to other functions which understand the types in the new
167
168
)
168
169
)
169
170
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
+
170
224
171
225
)
172
226
@@ -273,37 +327,22 @@ $(CHANGELOG_SEP_TEXT_BUGZILLA)
273
327
274
328
$(BUGSTITLE_BUGZILLA DMD Compiler regression fixes,
275
329
276
- $(LI $(BUGZILLA 20802): [REG2.088.0] Link failure with writefln)
277
330
$(LI $(BUGZILLA 24179): Ddoc broke D code sections)
278
331
$(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
332
)
281
333
$(BUGSTITLE_BUGZILLA DMD Compiler bug fixes,
282
334
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
335
$(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
336
$(LI $(BUGZILLA 23786): __traits$(LPAREN)parent, {}$(RPAREN) in overloaded function produces wierd results dependent on declaration order)
289
337
$(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
338
$(LI $(BUGZILLA 24293): ImportC: C preprocessor output should use temporary files)
292
339
$(LI $(BUGZILLA 24309): Memory allocation failed on Azure pipeline)
293
340
$(LI $(BUGZILLA 24359): slice equality expression can be discarded)
294
341
$(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
342
$(LI $(BUGZILLA 24383): Index assignment expression in __traits$(LPAREN)compiles$(RPAREN) fails to parse)
298
343
$(LI $(BUGZILLA 24387): Base class construction ignores private)
299
344
$(LI $(BUGZILLA 24389): importC: Building zlib in Phobos with importC fails on FreeBSD 14)
300
345
$(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
346
)
308
347
$(BUGSTITLE_BUGZILLA DMD Compiler enhancements,
309
348
0 commit comments