Footnotes

Foreword by Scott Meyers

1 Actually, it’s optional. As befits a systems programming language, if you really want to perform manual memory management, D will let you.

Chapter 1

1 This book consistently uses parameter to refer to the value accepted and used inside the function and argument when talking about the value passed from the outside to the function during invocation.

2 If one of your C++ fellow coders has Superman-level confidence, ask him or her what the syntax object.template fun<arg>() does and you’ll see Kryptonite at work.

3 To add insult to injury, << and >> are operators, too.

4 Apologies for the slightly pretentious persona. The problem with the worldlier character is that it creates confusion with the likes of char.

5 NaN is a good default initializer for floats, but unfortunately, no equivalent initializer exists for integral numbers.

Chapter 2

1 For the theoretically inclined, the automata in Figure 2.1 and Figure 2.2 are “deterministic finite automata” (DFAs).

2 Yes, the syntax is odd, but D copied C99s syntax rather than devising yet another notation with its own inevitable set of quirks.

3 IEEE 754 floating-point numbers have two distinct bit patterns for zero, denoted as -0 and +0. They cause minor aggravations such as the special case herein but also speed up many calculations. You’d seldom use the -0.0 literal in D, but it may be produced surreptitiously as the result of a calculation that asymptotically approaches zero with negative values.

Chapter 3

1 Insert the obligatory “yet another use of the static keyword.”

2 C++’s STL consistently uses != to test for iteration’s end, on the grounds that (in)equality is more general as it applies to a larger category of types. D’s approach is no less general but speculatively uses < when available, to the goal of increased safety of iteration at no overall cost in abstraction or efficiency.

Chapter 5

1 This situation puts the “partial” in “partial ordering.” Under a total order (e.g., for real numbers), there are no unordered elements.

2 Similar to the approach of ML and other functional language implementations.

3 The case c = 0 is also allowed, but the associated theory is more difficult so here we require c > 0.

4 Somehow, Euclid’s algorithm always manages to make its way into good (ahem) programming books.

Chapter 7

1 Barring simple name equivalence created with alias, which we’ll look at later in this chapter (§ 7.4 on page 276).

2 The term clucts was coined by Bartosz Milewski.

3 In addition, code1 may save a pointer to w that code2 uses.

Chapter 8

1 This is the approach taken by C++’s const.

2 Solution suggested by Simon Peyton-Jones.

Chapter 11

1 The text uses / as a generic path separator, with the understanding that the actual separator is system-dependent.

Chapter 13

1 The following discussion focuses on general concurrency and does not discuss vector operation parallelization and other specialized parallel kernels.

2 This is ironic because shared memory has been faster than message passing in the classic multithreading days.

3 Even the topic title was changed from “Threads” to “Concurrency” to reflect the fact that threads are but one concurrency model.

4 Erlang processes are distinct from OS processes.

5 That must be an antonym for the phrase “to add insult to injury.”

6 Incidentally, you can share a wallet with theft-protected money with the help of const by using the type shared(const(Money)*).

7 A potential source of confusion is that Windows uses the term critical section for lightweight mutex objects that protect a critical section and mutex for heavier-weight mutexes that help inter-process communication.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.142.85