forked from dlang/dlang.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glossary.dd
262 lines (225 loc) · 9.17 KB
/
glossary.dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
Ddoc
$(D_S Glossary,
$(DL
$(DT $(LNAME2 blit, $(ACRONYM BLIT, Block Transfer)))
$(DD Also known as BLT, blit refers to copying memory
byte for byte. In C, this is referred to as a memcpy
operation.
The name originated with the BLT instruction on the
DEC PDP-10 computer.
)
$(DT $(LNAME2 ctfe, $(ACRONYM CTFE, Compile Time Function Evaluation)))
$(DD Refers to the ability to execute regular D
functions at compile time rather than at run time.)
$(DT code point) $(DD In Unicode terminology, a $(LUCKY code point)
is a logical character. The range of code points is $(D 0)
through $(D 0x10FFFF). Only $(D dchar)s can store code points
directly; arrays of $(D char) and $(D wchar) need to use the
variable-length encodings $(LUCKY UTF-8) and $(LUCKY UTF-16).)
$(DT $(LNAME2 cow, $(ACRONYM COW, Copy On Write)))
$(DD COW is a memory management strategy where (usually large) reference
objects are copied if they are to be modified. The constant overhead of COW can be
high, but may be preferable in applications that would otherwise do a lot of
preemptive copying.
)
$(DT $(LEGACY_LNAME2 data_race, data-race, Data Race)) $(DD Two or more threads writing to
the same memory location. Program behavior may depend on the arbitrary
sequencing of these memory accesses.
)
$(DT $(LNAME2 functor, Functor)) $(DD A user-defined type (struct or
class) that defines the function call operator ($(D opCall) in D) so it
can be used similarly to a function.
)
$(DT $(LNAME2 gc, $(ACRONYM GC, Garbage Collection)))
$(DD Garbage collection is the common name for the
term automatic memory management. Memory can be allocated and used,
and the GC will automatically free any chunks of memory no longer
referred to. In contrast, explicit memory management
is where the programmer must carefully match up each allocation with
one and only one call to free().
)
$(DT Higher-order function) $(DD A function that either accepts another
function as a parameter, returns a function, or both.
)
$(DT $(LNAME2 ifti, $(ACRONYM IFTI, Implicit Function Template Instantiation)))
$(DD Refers to the ability to instantiate a template function
without having to explicitly pass in the types to the template.
Instead, the types are infered automatically from the types of the
runtime arguments.)
$(DT Illegal)
$(DD A code construct is illegal if it does not conform to the
D language specification.
This may be true even if the compiler or runtime fails to detect
the error.
)
$(DT Input range) $(DD A type (i.e., a struct or a class) that
defines the member functions empty, head, and next. Input ranges
are assumed to be strictly one-pass: there is no way to save the
state of the iteration in a copy of the range. See also $(LINK2
phobos/std_range.html,range).)
$(DT Implementation Defined Behavior)
$(DD This is variation in behavior of the D language in a manner
that is up to the implementor of the language.
An example of implementation defined behavior would be the size in
bytes of a pointer: on a 32 bit machine it would be 4 bytes, on
a 64 bit machine it would be 8 bytes.
Minimizing implementation defined behavior in the language will
maximize the portability of code.
)
$(DT $(LNAME2 lvalue, lvalue))
$(DD An lvalue is an abstract term referring to a value with an accessible
address (through e.g. the unary $(D &) operator). Typical examples of
lvalues include variables, constants introduced with `const` or `immutable`
(but not `enum`), and elements of arrays and associative arrays. Calls to
functions that return `ref` and pointer dereference expressions are also
lvalues. Lvalues can be passed to (or be returned from) functions by
reference. An lvalue is the counterpart to an rvalue.
)
$(DT $(LNAME2 nrvo, $(ACRONYM NRVO, Named Return Value Optimization)))
$(DD
$(P NRVO is a technique invented by Walter Bright around
1991 (the term for it was coined later) to minimize copying of struct
data.
Functions normally return their function return values in
registers. For structs, however, they often are too big to
fit in registers. The usual solution to this is to pass to
the function a $(I hidden pointer) to a struct instance in the
caller's stack frame, and the return value is copied there.
For example:
)
---
struct S { int a, b, c, d; }
S foo()
{
S result;
result.a = 3;
return result;
}
void test()
{
S s = foo();
}
---
$(P is rewritten as:)
---
S* foo(S* hidden)
{
S result;
result.a = 3;
*hidden = result;
return hidden;
}
void test()
{
S tmp;
S s = *foo(&tmp);
}
---
$(P This rewrite gives us an extra temporary object $(D tmp),
and copies the struct contents twice.
What NRVO does is recognize that the sole purpose of $(D result)
is to provide a return value, and so all references to $(D result)
can be replaced with $(D *hidden).
$(D foo) is then rewritten as:
)
---
S* foo(S* hidden)
{
hidden.a = 3;
return hidden;
}
---
$(P A further optimization is done on the call to $(D foo) to eliminate
the other copy, giving:)
---
void test()
{
S s;
foo(&s);
}
---
$(P The result is written directly into the destination $(D s),
instead of passing through two other instances.)
)
$(DT $(LEGACY_LNAME2 narrow strings, narrow-strings, narrow strings)) $(DD All arrays
that use $(D char), $(D wchar), and their qualified versions are
narrow strings. (Those include $(D string) and $(D
wstring)). Range-oriented functions in the standard library handle
narrow strings specially by automatically decoding the UTF-encoded
characters.)
$(DT $(LEGACY_LNAME2 opApply, op-apply, opApply))
$(DD A special member function used to iterate over a
collection; this is used by the
$(LINK2 spec/statement.html#opApply, $(I ForeachStatement)).
)
$(DT $(LEGACY_LNAME2 opApplyReverse, op-apply-reverse, opApplyReverse))
$(DD A special member function used to iterate over a
collection in the reverse order; this is used by the
$(LINK2 spec/statement.html#opApplyReverse, $(I ForeachStatement)).
)
$(DT $(LNAME2 pod, $(ACRONYM POD, Plain Old Data)))
$(DD Refers to a struct that contains no hidden members,
does not have virtual functions, does not inherit,
has no destructor,
and can be initialized and copied via simple bit copies.
)
$(DT $(LNAME2 predicate, Predicate)) $(DD A function or
delegate returning a Boolean result. Predicates can be nullary
(take no arguments), unary (take one argument), binary (take
two arguments), or n-ary (take n arguments). Usually
predicates are mentioned within the context of higher-order
functions, which accept predicates as parameters.
)
$(DT $(LNAME2 raii, $(ACRONYM RAII, Resource Acquisition Is Initialization)))
$(DD RAII refers to the technique of having the destructor
of a class object called when the object goes out of scope.
The destructor then releases any resources acquired by
that object.
RAII is commonly used for resources that are in short supply
or that must have a predictable point when they are released.
RAII objects in D are created using the $(D scope) storage class.
)
$(DT $(LNAME2 rvalue, rvalue))
$(DD An rvalue is an abstract term referring to a value resulting from an
expression that has no accessible memory address. This lack of address is
only conceptual; the implementation has the liberty to store an rvalue in
addressable memory. Rvalues cannot be changed and cannot be passed to (or
be returned from) functions by reference. An rvalue is the counterpart to
an lvalue.
)
$(DT $(LEGACY_LNAME2 sequential_consistency, sequential-consistency, Sequential Consistency))
$(DD Data being written in one order in one thread
being visible in the same order to another thread.
)
$(DT $(LNAME2 sfinae, $(ACRONYM SFINAE, Substitution Failure Is Not An Error)))
$(DD If template argument deduction results in a type
that is not valid, that specialization of the template
is not considered further. It is not a compile error.
See also $(LINK2 https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error, SFINAE).
)
$(DT $(LNAME2 tmp, $(ACRONYM TMP, Template Metaprogramming)))
$(DD TMP is using the template features of the language to
execute programs at compile time rather than runtime.)
$(DT $(LNAME2 tls, $(ACRONYM TLS, Thread Local Storage)))
$(DD TLS allocates each thread its own instance of the
global data. See also
$(LINK2 https://en.wikipedia.org/wiki/Thread-local_storage, Wikipedia).)
$(DT $(LEGACY_LNAME2 undefined_behavior, undefined-behavior, $(ACRONYM UB, Undefined Behavior)))
$(DD Undefined behavior happens when an illegal code construct is
executed. Undefined behavior can include random, erratic results,
crashes, faulting, etc.
A buffer overflow is an example of undefined behavior.
)
$(DT $(LNAME2 uda, $(ACRONYM UDA, User-Defined Attribute)))
$(DD $(LINK2 spec/attribute.html#uda, $(I User-defined attributes)) are
metadata attached to symbols used for compile-time reflection.)
$(DT $(LNAME2 ufcs, $(ACRONYM UFCS, Uniform Function Call Syntax)))
$(DD $(LINK2 spec/function.html#pseudo-member, Uniform function call
syntax) refers to the ability to call a function as if it were a method of
its first argument. For example `funct(arg)` may be written as
`arg.funct()`.)
)
)
Macros:
TITLE=Glossary
D=<span class="d_inlinecode">$0</span>