Skip to content

Commit 503ce40

Browse files
committed
Merge remote-tracking branch 'upstream/master' into stable
2 parents ccef651 + e5b7e14 commit 503ce40

File tree

213 files changed

+60331
-1257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+60331
-1257
lines changed

.htaccess

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,11 @@ Redirect 301 /dips/1031 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP
224224
Redirect 301 /dips/1032 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1032.md
225225
Redirect 301 /dips/1033 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1033.md
226226
Redirect 301 /dips/1034 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1034.md
227+
Redirect 301 /dips/1035 https://github.com/dlang/DIPs/blob/master/DIPs/DIP1035.md
228+
Redirect 301 /dips/1036 https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1036.md
229+
Redirect 301 /dips/1037 https://github.com/dlang/DIPs/blob/master/DIPs/DIP1037.md
230+
Redirect 301 /dips/1038 https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1038.md
231+
Redirect 301 /dips/1039 https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1039.md
232+
Redirect 301 /dips/1040 https://github.com/dlang/DIPs/blob/master/DIPs/DIP1040.md
233+
Redirect 301 /dips/1041 https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1041.md
234+
Redirect 301 /dips/1042 https://github.com/dlang/DIPs/blob/master/DIPs/DIP1042.md

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# when someone opens a pull request that modifies code that they own.
1111
# Later matches take precedence.
1212

13-
spec/* @andralex @WalterBright
13+
spec/* @andralex @WalterBright @maxhaton @mdparker
1414
foundation.dd @andralex @acehreli @WalterBright
1515

1616
posix.mak @andralex @CyberShadow @MartinNowak @wilzbach

articles/ctarguments.dd

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,24 @@ $(HEADERNAV_TOC)
3636
---
3737
template Variadic(T...)
3838
{
39-
static assert (T.length > 1);
39+
static assert(T.length > 1);
4040
pragma(msg, T[0]);
4141
pragma(msg, T[1]);
4242
}
4343

4444
alias dummy = Variadic!(int, 42);
45-
// prints during compilation:
46-
// int
47-
// 42
4845
---
46+
$(P Output during compilation:)
47+
$(CONSOLE
48+
int
49+
42
50+
)
4951

5052
$(H2 $(LNAME2 AliasSeq, AliasSeq))
5153

5254
$(P The language itself does not provide any means to define such sequences outside of
5355
a template parameter declaration. Instead, there is a
54-
$(MREF_ALTTEXT simple utility, std, meta) provided by the standard
56+
$(REF_ALTTEXT simple template, AliasSeq, std,meta) provided by the standard
5557
library:
5658
)
5759

@@ -79,7 +81,7 @@ $(H2 $(LNAME2 available-operations, Available operations))
7981

8082
---
8183
import std.meta;
82-
static assert (AliasSeq!(1, 2, 3, 4).length == 4);
84+
static assert(AliasSeq!(1, 2, 3, 4).length == 4);
8385
---
8486

8587
$(H3 $(LNAME2 indexing-slicing, Indexing and slicing))
@@ -88,13 +90,17 @@ $(H2 $(LNAME2 available-operations, Available operations))
8890

8991
---
9092
import std.meta;
91-
alias Numbers = AliasSeq!(1, 2, 3, 4);
92-
static assert (Numbers[1] == 2);
93-
alias SubNumbers = Numbers[1 .. $];
94-
static assert (SubNumbers[0] == 2);
93+
94+
alias nums = AliasSeq!(1, 2, 3, 4);
95+
static assert(nums[1] == 2);
96+
97+
// slice last 3 elements
98+
alias tail = nums[1 .. $];
99+
static assert(tail[0] == 2);
100+
static assert(tail.length == 3);
95101
---
96102

97-
$(H3 $(LNAME2 assignment, Assignment))
103+
$(H4 $(LNAME2 assignment, Element assignment))
98104

99105
$(P Works only if the sequence element is a symbol that refers to a mutable variable)
100106

@@ -106,12 +112,12 @@ $(H2 $(LNAME2 available-operations, Available operations))
106112
int x;
107113
alias seq = AliasSeq!(10, x);
108114
seq[1] = 42;
109-
assert (x == 42);
115+
assert(x == 42);
110116
// seq[0] = 42; // won't compile, can't assign to a constant
111117
}
112118
---
113119

114-
$(H3 $(LNAME2 loops, Loops))
120+
$(H3 $(LNAME2 loops, `foreach`))
115121

116122
$(P D's $(DDSUBLINK spec/statement, ForeachStatement, foreach statement) has special
117123
semantics when iterating over compile-time sequences. It repeats the body of the loop
@@ -132,13 +138,13 @@ $(H2 $(LNAME2 available-operations, Available operations))
132138
pragma (msg, typeof(sym));
133139
}
134140
}
135-
136-
/* Prints:
137-
int
138-
string
139-
void()
140-
*/
141141
---
142+
$(P Output during compilation:)
143+
$(CONSOLE
144+
int
145+
string
146+
void()
147+
)
142148

143149
$(P $(B Note:) $(DDSUBLINK version, staticforeach, Static foreach)
144150
should be preferred in new code.)
@@ -182,9 +188,11 @@ $(H3 $(LNAME2 type-seq, Type sequences))
182188
import std.meta;
183189
alias Params = AliasSeq!(int, double, string);
184190
void foo(Params); // void foo(int, double, string);
191+
192+
foo(7, 6.5, "hi");
185193
---
186194

187-
$(H4 $(LNAME2 type-seq-instantiation, Type sequence instantiation))
195+
$(H3 $(LNAME2 type-seq-instantiation, Type sequence instantiation))
188196

189197
$(P D supports a special variable declaration syntax where a type sequence acts as a type:)
190198

@@ -211,7 +219,7 @@ $(H4 $(LNAME2 type-seq-instantiation, Type sequence instantiation))
211219
variables, known as an $(I lvalue sequence).)
212220

213221
$(P $(DDSUBLINK spec/template, variadic-templates, Variadic template functions)
214-
use a type sequence instance for a function parameter:)
222+
use a type sequence instance to declare function parameters:)
215223

216224
---
217225
void foo(T...)(T args)
@@ -223,9 +231,6 @@ $(H4 $(LNAME2 type-seq-instantiation, Type sequence instantiation))
223231
}
224232
---
225233

226-
$(P $(B Note:) $(REF Tuple, std, typecons) wraps a type sequence instance,
227-
preventing auto-expansion, and allowing it to be returned from functions.)
228-
229234
$(H3 $(LNAME2 value-seq, Value sequences))
230235

231236
$(P It is possible to use a sequence of values of the same type to declare an array literal:)
@@ -248,20 +253,41 @@ $(H3 $(LNAME2 value-seq, Value sequences))
248253
swap(pair);
249254
assert(x == 7 && y == 3);
250255
---
251-
$(P As above, such sequences may use $(ALOCAL assignment, assignment).)
252-
253-
$(H4 $(LNAME2 tupleof, Aggregate field sequences))
256+
$(P As above, such sequences may use
257+
$(ALOCAL assignment, element assignment).)
254258

255259
$(P $(DDSUBLINK spec/class, class_properties, `.tupleof`) is a
256260
class/struct instance property that provides an lvalue sequence
257261
of each field.)
258262

263+
$(P A function cannot return a value sequence. Instead,
264+
$(REF Tuple, std, typecons) can be used. It wraps an lvalue
265+
sequence in a struct, preventing auto-expansion.)
266+
259267
$(H3 $(LNAME2 symbol-seq, Symbol sequences))
260268

261269
$(P A symbol sequence aliases any named symbol - types, variables, functions and templates -
262270
but not literals.
263271
Like an alias sequence, the kind of elements can be mixed.)
264272

273+
---
274+
import std.meta : AliasSeq;
275+
276+
void f(T)(T v)
277+
{
278+
pragma(msg, T);
279+
}
280+
alias syms = AliasSeq!(f, f!byte);
281+
syms[0](42); // call f!int with IFTI
282+
syms[1](42); // call f!byte
283+
---
284+
$(P Output during compilation:)
285+
$(CONSOLE
286+
byte
287+
int
288+
)
289+
$(P Note that function `f!byte` is instantiated when the sequence is
290+
created, not at the call-site.)
265291
)
266292

267293
Macros:

articles/ctod.dd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ signed char => byte
8585
unsigned char => ubyte
8686
short => short
8787
unsigned short => ushort
88-
wchar_t => wchar
88+
wchar_t => core.stdc.stddef.wchar_t
8989
int => int
9090
unsigned => uint
91-
long => int
92-
unsigned long => uint
91+
long => core.stdc.config.c_long
92+
unsigned long => core.stdc.config.c_ulong
9393
long long => long
9494
unsigned long long => ulong
9595
float => float

articles/d-floating-point.dd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ $(D nextDown(x)) gives the next representable number which is less than x.
8181

8282
$(P Numerical analysts often describe errors in terms of "units in the last place"(ulp), a surprisingly subtle term which is often used rather carelessly. [footnote:
8383
The most formal definition is found in [J.-M. Muller, "On the definition of ulp(x)",INRIA Technical Report 5504 (2005).]: If $(D x) is a real number that lies between two finite consecutive floating-point numbers a and b of type F, without being equal to one of them, then ulp(x)=abs(b-a); otherwise ulp(x) = $(D x*F.epsilon). Moreover, ulp(NaN) is NaN, and ulp($(PLUSMN)F.infinity) = $(PLUSMN)$(D F.max*F.epsilon).]
84-
I prefer a far simpler definition: The difference in ulps between two numbers x and y is is the number of times which you need to call nextUp() or nextDown() to move from x to y. [Footnote: This will not be an integer if either x or y is a real number, rather than a floating point number.]
84+
I prefer a far simpler definition: The difference in ulps between two numbers x and y is the number of times which you need to call nextUp() or nextDown() to move from x to y. [Footnote: This will not be an integer if either x or y is a real number, rather than a floating point number.]
8585
The D library function $(D feqrel(x, y)) gives the number of bits which are equal between x and y; it is an easy way to check for loss-of-precision problems.
8686
)
8787

@@ -176,7 +176,7 @@ $(TR $(TD max_10_exp) $(TD +38) $(TD +308) $(TD +4932) $(TD +4932) $(TD 385) $(T
176176
)
177177

178178
$(P When writing code which should adapt to different CPUs at compile time, use $(D static if) with the $(D mant_dig) property. For example, $(D static if (real.mant_dig==64)) is true if 80-bit reals are available.
179-
For binary types, the $(D dig) property gives only the $(I minimum) number of valid decimal digits. To ensure that that every representable number has a unique decimal representation, two additional digits are required. Similarly, for decimal numbers, $(D mant_dig) is a lower bound on the number of valid binary digits.
179+
For binary types, the $(D dig) property gives only the $(I minimum) number of valid decimal digits. To ensure that every representable number has a unique decimal representation, two additional digits are required. Similarly, for decimal numbers, $(D mant_dig) is a lower bound on the number of valid binary digits.
180180
)
181181

182182
$(H2 Useful relations for a floating point type $(D F), where $(D x) and $(D y) are of type $(D F))

articles/hijack.dd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ to add the rules:
130130
$(OL
131131
$(LI by default functions can only overload against other functions in the same
132132
module)
133-
$(LI if a name is found in more than one scope, in order to use it it must
133+
$(LI if a name is found in more than one scope, in order to use it, it must
134134
be fully qualified)
135135
$(LI in order to overload functions from multiple modules together, an alias
136136
statement is used to merge the overloads)

articles/index.dd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ $(D_S Articles,
104104
in D.)
105105
)
106106
$(DIVC item,
107-
$(H4 $(LINK2 $(ROOT_DIR)articles/mixin.html, Mixins))
107+
$(H4 $(LINK2 $(ROOT_DIR)articles/mixin.html, String Mixins))
108108
$(P A short article about D's $(D mixin) statement which allows
109109
to insert arbitrary code from a string, and how it compares
110110
to the C preprocessor.)

articles/lazy-evaluation.dd

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,7 @@ if (!p)
249249
p.bar(); // now use p
250250
---
251251

252-
$(P Because throw is a statement, not an expression, expressions that
253-
need to do this need to be broken up into multiple statements,
254-
and extra variables are introduced.
255-
(For a thorough treatment of this issue, see Andrei Alexandrescu and
256-
Petru Marginean's paper
257-
$(LINK2 https://erdani.org/publications/cuj-06-2003.php.html, Enforcements)).
252+
$(P
258253
With lazy evaluation, this can all be encapsulated into a single
259254
function:
260255
)
@@ -312,4 +307,3 @@ Macros:
312307
SUBNAV=$(SUBNAV_ARTICLES)
313308

314309
NG_digitalmars_D = <a href="http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com$(AMP)group=digitalmars.D$(AMP)artnum=$0">D/$0</a>
315-

articles/mixin.dd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Ddoc
22

3-
$(D_S Mixins,
3+
$(D_S String Mixins,
44

5-
$(P Mixins (not to be confused with
5+
$(P String Mixins (not to be confused with
66
$(DDLINK spec/template-mixin, Template Mixins, template mixins))
77
enable string constants to be compiled as regular D code
88
and inserted into the program.
@@ -91,5 +91,5 @@ END
9191
)
9292

9393
Macros:
94-
TITLE=Mixins
94+
TITLE=String Mixins
9595
SUBNAV=$(SUBNAV_ARTICLES)

0 commit comments

Comments
 (0)