Foreword by Andrei Alexandrescu xvii
Preface xix
Acknowledgments .............................................................................................................xix
1. The Hello World Program 1
Compiler installation ............................................................................................................1
Source file...................................................................................................................................1
Compiling the hello world program ...............................................................................1
Compiler switches ................................................................................................................. 2
IDE................................................................................................................................................ 3
Contents of the hello world program ............................................................................ 3
Exercises .................................................................................................................................... 4
2. writelnand write 5
Exercises .................................................................................................................................... 5
3. Compilation 6
Machine code .......................................................................................................................... 6
Programming language....................................................................................................... 6
Interpreter ................................................................................................................................ 6
Compiler .................................................................................................................................... 7
4. Fundamental Types 8
Properties of types................................................................................................................. 9
size_t......................................................................................................................................10
Exercise ....................................................................................................................................10
5. Assignment and Order of Evaluation 11
The assignment operation ................................................................................................11
Order of evaluation..............................................................................................................11
Exercise .....................................................................................................................................11
6. Variables 12
Exercise .................................................................................................................................... 13
7. Standard Input and Output Streams 14
Exercise .................................................................................................................................... 14
8. Reading from the Standard Input 15
Skipping the whitespace characters............................................................................ 16
Additional information..................................................................................................... 17
Exercise .................................................................................................................................... 17
9. Logical Expressions 18
Logical Expressions............................................................................................................. 18
Grouping expressions ........................................................................................................ 21
Reading boolinput............................................................................................................. 21
Exercises .................................................................................................................................. 21
10. ifStatement 24
The ifblock and its scope ...............................................................................................24
The elseblock and its scope ..........................................................................................24
Always use the scope curly brackets............................................................................25
The "if, else if, else" chain..................................................................................................25
Exercises ..................................................................................................................................27
11. whileLoop 28
The continuestatement ..................................................................................................28
The breakstatement..........................................................................................................29
v
Unconditional loop .............................................................................................................29
Exercises ..................................................................................................................................30
12. Integers and Arithmetic Operations 31
Exercises .................................................................................................................................. 41
13. Floating Point Types 42
Floating point type properties........................................................................................42
.nan...........................................................................................................................................43
Specifying floating point values ....................................................................................43
Overflow is not ignored.....................................................................................................44
Precision ..................................................................................................................................45
There is no truncation in division ................................................................................45
Which type to use ................................................................................................................46
Cannot represent all values.............................................................................................46
Unorderedness......................................................................................................................47
Exercises ..................................................................................................................................48
14. Arrays 49
Definition ................................................................................................................................49
Containers and elements..................................................................................................50
Accessing the elements......................................................................................................50
Index ..........................................................................................................................................51
Fixed-length arrays vs. dynamic arrays ......................................................................51
Using .lengthto get or set the number of elements ............................................51
An array example ................................................................................................................52
Initializing the elements...................................................................................................52
Basic array operations ....................................................................................................... 53
Exercises .................................................................................................................................. 55
15. Characters 57
History......................................................................................................................................57
Unicode encodings..............................................................................................................58
The character types of D...................................................................................................59
Character literals .................................................................................................................59
Control characters.............................................................................................................. 60
Single quote and backslash ............................................................................................ 60
The std.uni module ............................................................................................................. 61
Limited support for ı and i ...............................................................................................62
Problems with reading characters ...............................................................................62
D's Unicode support............................................................................................................63
Summary.................................................................................................................................64
16. Slices and Other Array Features 65
Slices..........................................................................................................................................65
Using $, instead of array.length................................................................................66
Using .dupto copy ..............................................................................................................66
Assignment.............................................................................................................................67
Making a slice longer may terminate sharing.........................................................67
Operations on all elements............................................................................................. 70
Multi-dimensional arrays ................................................................................................72
Summary.................................................................................................................................74
Exercise ....................................................................................................................................74
17. Strings 75
readlnand strip, instead of readf...........................................................................75
formattedReadfor parsing strings .............................................................................76
vi
Double quotes, not single quotes...................................................................................77
string, wstring, and dstringare immutable......................................................77
Potentially confusing length of strings.......................................................................78
String literals .........................................................................................................................79
String concatenation..........................................................................................................79
Comparing strings.............................................................................................................. 80
Lowercase and uppercase are different..................................................................... 80
Exercises .................................................................................................................................. 81
18. Redirecting the Standard Input and Output Streams 82
Redirecting the standard output to a file with operator >..................................82
Redirecting the standard input from a file with operator <..............................82
Redirecting both standard streams..............................................................................83
Piping programs with operator |..................................................................................83
Exercise ....................................................................................................................................83
19. Files 84
Fundamental concepts ......................................................................................................84
std.stdio.Filestruct.....................................................................................................86
Exercise ....................................................................................................................................87
20. autoand typeof 88
auto...........................................................................................................................................88
typeof......................................................................................................................................88
Exercise ....................................................................................................................................89
21. Name Scope 90
Defining names closest to their first use................................................................... 90
22. forLoop 92
The sections of the whileloop.......................................................................................92
The sections of the forloop............................................................................................92
The sections may be empty .............................................................................................93
The name scope of the loop variable ...........................................................................94
Exercises ..................................................................................................................................94
23. Ternary Operator ?: 95
The type of the ternary expression ..............................................................................96
Exercise ....................................................................................................................................97
24. Literals 98
Integer literals.......................................................................................................................98
Floating point literals...................................................................................................... 100
Character literals .............................................................................................................. 100
String literals ....................................................................................................................... 101
Literals are calculated at compile time.....................................................................102
Exercises ................................................................................................................................102
25. Formatted Output 103
format_character ................................................................................................................ 104
width........................................................................................................................................106
separator.................................................................................................................................106
precision..................................................................................................................................107
flags ..........................................................................................................................................107
Positional parameters......................................................................................................108
Formatted element output.............................................................................................109
format.................................................................................................................................... 110
Exercises ................................................................................................................................. 111
vii
26. Formatted Input 112
Format specifier characters............................................................................................113
Exercise ...................................................................................................................................113
27. do-whileLoop 114
Exercise ...................................................................................................................................115
28. Associative Arrays 116
Definition .............................................................................................................................. 116
Adding key-value pairs .................................................................................................... 117
Initialization ........................................................................................................................ 117
Removing key-value pairs .............................................................................................. 117
Determining the presence of a key............................................................................. 118
Properties .............................................................................................................................. 118
Example ................................................................................................................................. 119
Exercises ................................................................................................................................ 119
29. foreachLoop 120
The foreachsyntax..........................................................................................................120
continueand break........................................................................................................ 121
foreachwith arrays......................................................................................................... 121
foreachwith strings and std.range.stride..................................................... 121
foreachwith associative arrays .................................................................................122
foreachwith number ranges ......................................................................................122
foreachwith structs, classes, and ranges...............................................................122
The counter is automatic only for arrays................................................................ 123
The copy of the element, not the element itself .................................................... 123
The integrity of the container must be preserved ...............................................124
foreach_reverseto iterate in the reverse direction.........................................124
Exercise .................................................................................................................................. 125
30. switchand case 126
The gotostatement...........................................................................................................126
The expression must be an integer, string, or booltype ..................................128
Value ranges.........................................................................................................................129
Distinct values.....................................................................................................................129
The final switchstatement ......................................................................................129
When to use..........................................................................................................................130
Exercises ................................................................................................................................130
31. enum 131
Effects of magic constants on code quality..............................................................131
The enumsyntax ..................................................................................................................131
Actual values and base types ........................................................................................ 132
enumvalues that are not of an enumtype................................................................. 132
Properties .............................................................................................................................. 133
Converting from the base type.....................................................................................134
Exercise ..................................................................................................................................134
32. Functions 135
Parameters............................................................................................................................ 136
Calling a function .............................................................................................................. 138
Doing work........................................................................................................................... 138
The return value................................................................................................................. 138
The returnstatement .....................................................................................................139
voidfunctions ....................................................................................................................139
viii
The name of the function.............................................................................................. 140
Code quality through functions.................................................................................. 140
Exercises ................................................................................................................................144
33. Immutability 146
Immutable variables ........................................................................................................146
Immutable parameters....................................................................................................149
Immutability of the slice versus the elements....................................................... 153
How to use ............................................................................................................................ 154
Summary............................................................................................................................... 155
34. Value Types and Reference Types 156
Value types............................................................................................................................ 156
Reference variables........................................................................................................... 157
Reference types................................................................................................................... 158
Fixed-length arrays are value types, slices are reference types......................162
Experiment...........................................................................................................................162
Summary...............................................................................................................................164
35. Function Parameters 165
Parameters are always copied ...................................................................................... 165
Referenced variables are not copied..........................................................................166
Parameter qualifiers .........................................................................................................168
Summary...............................................................................................................................176
Exercise ..................................................................................................................................177
36. Lvalues and Rvalues 178
Limitations of rvalues......................................................................................................178
Using auto refparameters to accept both lvalues and rvalues ..................179
Terminology.........................................................................................................................180
37. Lazy Operators 181
38. Program Environment 182
The return value of main()...........................................................................................182
Standard error stream stderr.....................................................................................184
Parameters of main()......................................................................................................184
Command line options and the std.getoptmodule ........................................ 185
Environment variables....................................................................................................187
Starting other programs .................................................................................................187
Summary...............................................................................................................................188
Exercises ................................................................................................................................188
39. Exceptions 189
The throwstatement to throw exceptions ..............................................................189
The try-catchstatement to catch exceptions .....................................................194
Exception properties ........................................................................................................199
Kinds of errors ...................................................................................................................200
Summary..............................................................................................................................202
40. scope 203
41. assertand enforce 205
Syntax.................................................................................................................................... 205
static assert.................................................................................................................206
asserteven if absolutely true.......................................................................................207
No value nor side effect..................................................................................................207
Disabling assertchecks ...............................................................................................208
enforcefor throwing exceptions..............................................................................208
ix
How to use ...........................................................................................................................208
Exercises ...............................................................................................................................209
42. Unit Testing 211
Causes of bugs ..................................................................................................................... 211
Discovering the bugs ........................................................................................................ 211
Unit testing for catching bugs ......................................................................................212
Activating the unit tests .................................................................................................. 213
unittestblocks................................................................................................................. 213
Testing for exceptions ......................................................................................................214
Test driven development................................................................................................. 215
Exercise ..................................................................................................................................217
43. Contract Programming 218
inblocks for preconditions...........................................................................................218
outblocks for postconditions ......................................................................................219
Disabling contract programming ...............................................................................221
inblocks versus enforcechecks................................................................................221
Exercise ................................................................................................................................. 222
44. Lifetimes and Fundamental Operations 224
Lifetime of a variable....................................................................................................... 224
Lifetime of a parameter.................................................................................................. 224
Fundamental operations ................................................................................................225
45. The nullValue and the isOperator 229
The nullvalue ................................................................................................................... 229
The isoperator ................................................................................................................. 230
The !isoperator............................................................................................................... 230
Assigning the nullvalue............................................................................................... 230
Summary............................................................................................................................... 231
46. Type Conversions 233
Automatic type conversions..........................................................................................233
Explicit type conversions............................................................................................... 238
Summary...............................................................................................................................241
47. Structs 242
Definition ............................................................................................................................. 242
Accessing the members .................................................................................................. 244
Construction ....................................................................................................................... 245
Copying and assignment ............................................................................................... 247
Struct literals ...................................................................................................................... 249
staticmembers............................................................................................................... 249
Exercises ................................................................................................................................252
48. Variable Number of Parameters 254
Default arguments ........................................................................................................... 254
Variadic functions ............................................................................................................ 256
Exercise ................................................................................................................................. 259
49. Function Overloading 261
Overload resolution......................................................................................................... 262
Function overloading for user-defined types........................................................ 262
Limitations .......................................................................................................................... 263
Exercise ................................................................................................................................. 264
50. Member Functions 265
Defining member functions......................................................................................... 265
x
Exercises ............................................................................................................................... 269
51. const refParameters and constMember Functions 271
immutableobjects.............................................................................................................271
refparameters that are not const............................................................................271
const refparameters....................................................................................................271
Non-constmember functions .................................................................................... 272
constmember functions ............................................................................................. 272
inoutmember functions ...............................................................................................273
How to use ........................................................................................................................... 274
52. Constructor and Other Special Functions 275
Constructor ..........................................................................................................................275
Destructor ............................................................................................................................ 284
Postblit................................................................................................................................... 287
Assignment operator....................................................................................................... 288
Summary..............................................................................................................................290
53. Operator Overloading 291
Overloadable operators.................................................................................................. 293
Element indexing and slicing operators ................................................................. 295
Defining more than one operator at the same time........................................... 296
Return types of operators.............................................................................................. 297
opEquals()for equality comparisons.................................................................... 299
opCmp()for sorting..........................................................................................................300
opCall()to call objects as functions....................................................................... 302
Indexing operators........................................................................................................... 303
Slicing operators ............................................................................................................... 306
opCastfor type conversions........................................................................................ 308
Catch-all operator opDispatch....................................................................................310
Inclusion query by opBinaryRight!"in"..............................................................310
Exercise .................................................................................................................................. 312
54. Classes 315
Comparing with structs .................................................................................................. 315
Summary.............................................................................................................................. 320
55. Inheritance 321
Warning: Inherit only if "is a" .......................................................................................323
Inheritance from at most one class............................................................................323
Hierarchy charts ............................................................................................................... 324
Accessing superclass members ................................................................................... 324
Constructing superclass members .............................................................................325
Overriding the definitions of member functions................................................ 326
Using the subclass in place of the superclass.........................................................327
Inheritance is transitive................................................................................................. 328
Abstract member functions and abstract classes................................................ 329
Example ................................................................................................................................ 330
Summary...............................................................................................................................333
Exercises ................................................................................................................................333
56. Object 335
typeidand TypeInfo......................................................................................................335
toString...............................................................................................................................337
opEquals...............................................................................................................................337
opCmp...................................................................................................................................... 340
xi
toHash................................................................................................................................... 342
Exercises ............................................................................................................................... 344
57. Interfaces 347
Definition ............................................................................................................................. 347
Inheriting from an interface................................................................................... 347
Inheriting from more than one interface.......................................................... 348
Inheriting from interfaceand class................................................................... 349
Inheriting interfacefrom interface.................................................................. 349
staticmember functions............................................................................................ 349
finalmember functions ............................................................................................... 351
How to use ............................................................................................................................352
Abstraction ...........................................................................................................................352
Example .................................................................................................................................353
Summary...............................................................................................................................354
58. destroyand scoped 356
An example of calling destructors late .....................................................................356
destroy()to execute the destructor ........................................................................357
When to use..........................................................................................................................357
Example .................................................................................................................................357
scoped()to call the destructor automatically .................................................... 360
Summary............................................................................................................................... 361
59. Modules and Libraries 363
Packages................................................................................................................................ 364
Importing modules .......................................................................................................... 364
Libraries................................................................................................................................ 369
60. Encapsulation and Protection Attributes 372
Encapsulation......................................................................................................................373
Protection attributes ........................................................................................................373
Definition ............................................................................................................................. 374
Module imports are private by default.................................................................... 374
When to use encapsulation ...........................................................................................375
Example ................................................................................................................................ 376
61. Universal Function Call Syntax (UFCS) 378
62. Properties 381
Calling functions without parentheses .................................................................... 381
Property functions that return values...................................................................... 381
Property functions that are used in assignment ................................................. 382
Properties are not absolutely necessary ..................................................................383
When to use......................................................................................................................... 384
63. Contract Programming for Structs and Classes 386
Preconditions and postconditions for member functions.............................. 386
Preconditions and postconditions for object consistency .............................. 387
invariant()blocks for object consistency.......................................................... 388
Contract inheritance ....................................................................................................... 389
Summary...............................................................................................................................391
64. Templates 393
Function templates .......................................................................................................... 394
More than one template parameter...........................................................................395
Type deduction................................................................................................................... 396
Explicit type specification............................................................................................. 396
xii
Template instantiation ................................................................................................... 397
Template specializations................................................................................................ 397
Struct and class templates ............................................................................................ 398
Default template parameters.......................................................................................400
Every template instantiation yields a distinct type............................................ 401
A compile-time feature................................................................................................... 401
Class template example: stack data structure ...................................................... 401
Function template example: binary search algorithm .....................................404
Summary..............................................................................................................................406
65. Pragmas 408
pragma(msg)......................................................................................................................408
pragma(lib)......................................................................................................................408
pragma(inline)...............................................................................................................408
pragma(startaddress)................................................................................................ 410
pragma(mangle)............................................................................................................... 410
66. aliasand with 412
alias.......................................................................................................................................412
with.........................................................................................................................................416
Summary...............................................................................................................................417
67. alias this 418
Multiple inheritance.........................................................................................................418
68. Pointers 421
The concept of a reference.............................................................................................421
Syntax.................................................................................................................................... 423
Pointer value and the address-of operator &......................................................... 424
The access operator *...................................................................................................... 425
The .(dot) operator to access a member of the pointee................................... 425
Modifying the value of a pointer................................................................................ 426
Pointers are risky.............................................................................................................. 428
The element one past the end of an array.............................................................. 428
Using pointers with the array indexing operator []......................................... 429
Producing a slice from a pointer................................................................................ 430
void*can point at any type ......................................................................................... 430
Using pointers in logical expressions........................................................................431
newreturns a pointer for some types ....................................................................... 432
The .ptrproperty of arrays..........................................................................................433
The inoperator of associative arrays .......................................................................433
When to use pointers ...................................................................................................... 434
Examples ...............................................................................................................................435
Exercises ...............................................................................................................................440
69. Bit Operations 442
Representation of data at the lowest level.............................................................. 442
Binary number system................................................................................................... 443
Hexadecimal number system...................................................................................... 444
Bit operations ..................................................................................................................... 446
Semantics............................................................................................................................. 450
Common uses ..................................................................................................................... 452
Exercises ............................................................................................................................... 454
70. Conditional Compilation 456
debug...................................................................................................................................... 456
xiii
version(tag)and version(level)...................................................................... 459
Assigning identifiers to debugand version.........................................................460
static if............................................................................................................................460
static assert..................................................................................................................461
Type traits ............................................................................................................................ 462
Summary.............................................................................................................................. 463
71. isExpression 464
is (T)................................................................................................................................... 464
is (T Alias).................................................................................................................... 464
is (T : OtherT)............................................................................................................ 465
is (T Alias : OtherT)............................................................................................. 465
is (T == Specifier).................................................................................................. 465
is (T identifier == Specifier)...................................................................... 467
is (/* ... */ Specifier, TemplateParamList)..................................... 468
72. Function Pointers, Delegates, and Lambdas 471
Function pointers ..............................................................................................................471
Anonymous functions .................................................................................................... 476
Delegates............................................................................................................................... 479
toString()with a delegateparameter............................................................... 483
Summary.............................................................................................................................. 485
73. foreachwith Structs and Classes 487
foreachsupport by range member functions..................................................... 487
foreachsupport by opApplyand opApplyReversemember functions . 489
Loop counter ....................................................................................................................... 492
Warning: The collection must not mutate during the iteration ................... 494
Exercises ............................................................................................................................... 495
74. Nested Functions, Structs, and Classes 496
Summary.............................................................................................................................. 499
75. Unions 500
Anonymous unions...........................................................................................................501
Dissecting other members .............................................................................................501
Examples .............................................................................................................................. 502
76. Labels and goto 506
goto........................................................................................................................................ 506
Loop labels ........................................................................................................................... 508
gotoin casesections...................................................................................................... 508
Summary.............................................................................................................................. 508
77. Tuples 509
Tupleand tuple().......................................................................................................... 509
AliasSeq............................................................................................................................... 512
.tupleofproperty............................................................................................................ 514
Summary............................................................................................................................... 515
78. More Templates 516
The shortcut syntax .......................................................................................................... 516
Kinds of templates............................................................................................................. 518
Kinds of template parameters...................................................................................... 521
typeof(this), typeof(super), and typeof(return).................................. 529
Template specializations................................................................................................ 530
Meta programming.......................................................................................................... 530
Compile-time polymorphism........................................................................................532
xiv
Code bloat..............................................................................................................................533
Template constraints........................................................................................................534
Using templates in multi-dimensional operator overloading ........................537
Summary.............................................................................................................................. 542
79. More Functions 543
Return type attributes......................................................................................................543
Behavioral attributes....................................................................................................... 546
Code safety attributes ...................................................................................................... 551
Compile time function execution (CTFE).................................................................552
Summary...............................................................................................................................554
80. Mixins 556
Template mixins.................................................................................................................556
String mixins .......................................................................................................................558
Mixin name spaces............................................................................................................559
String mixins in operator overloading .................................................................... 560
Mixed in destructors ........................................................................................................ 561
Importing text files............................................................................................................ 561
Example ................................................................................................................................ 562
81. Ranges 564
History................................................................................................................................... 564
Ranges are an integral part of D..................................................................................565
Traditional implementations of algorithms...........................................................565
Phobos ranges .................................................................................................................... 566
InputRange......................................................................................................................... 568
ForwardRange.....................................................................................................................577
BidirectionalRange......................................................................................................579
RandomAccessRange....................................................................................................... 580
OutputRange...................................................................................................................... 586
Range templates ................................................................................................................ 589
Summary.............................................................................................................................. 589
82. More Ranges 590
Range kind templates...................................................................................................... 590
ElementTypeand ElementEncodingType.............................................................593
More range templates ......................................................................................................593
Run-time polymorphism with inputRangeObject()and
outputRangeObject().................................................................................................. 594
Summary...............................................................................................................................595
83. static foreach 596
84. Parallelism 599
taskPool.parallel()...................................................................................................601
Task........................................................................................................................................602
taskPool.asyncBuf()..................................................................................................606
taskPool.map()...............................................................................................................608
taskPool.amap().............................................................................................................610
taskPool.reduce()........................................................................................................ 611
Multiple functions and tuple results .........................................................................614
TaskPool...............................................................................................................................614
Summary............................................................................................................................... 615
85. Message Passing Concurrency 616
Concepts.................................................................................................................................616
xv
Starting threads..................................................................................................................617
Thread identifiers ..............................................................................................................618
Message Passing .................................................................................................................619
Expecting different types of messages..................................................................... 623
Waiting for messages up to a certain time............................................................. 625
Exceptions during the execution of the worker................................................... 625
Detecting thread termination...................................................................................... 628
Mailbox management..................................................................................................... 630
Priority messages............................................................................................................... 631
Thread names...................................................................................................................... 631
Summary...............................................................................................................................633
86. Data Sharing Concurrency 634
Sharing is not automatic ............................................................................................... 634
sharedto share mutable data between threads...................................................635
A race condition example.............................................................................................. 636
synchronizedto avoid race conditions ................................................................. 637
shared static this()for single initialization and shared static
~this()for single finalization ....................................................................................641
Atomic operations ............................................................................................................ 642
Summary.............................................................................................................................. 644
87. Fibers 645
Call stack .............................................................................................................................. 645
Usage...................................................................................................................................... 647
Fibers in range implementations............................................................................... 648
Fibers in asynchronous input and output.............................................................. 654
Exceptions and fibers ...................................................................................................... 658
Cooperative multitasking.............................................................................................. 659
Summary..............................................................................................................................660
88. Memory Management 661
Memory..................................................................................................................................661
The garbage collector .......................................................................................................661
Allocating memory .......................................................................................................... 663
Alignment ............................................................................................................................ 668
Constructing variables at specific memory locations....................................... 673
Destroying objects explicitly........................................................................................ 677
Constructing objects at run time by name............................................................. 678
Summary.............................................................................................................................. 679
89. User Defined Attributes (UDA) 680
Example ................................................................................................................................ 682
The benefit of user defined attributes...................................................................... 684
Summary.............................................................................................................................. 685
90. Operator Precedence 686
Exercise Solutions 689
Index 734
The main aim of this book is to teach D to readers who are new to computer programming. Although having experience in other programming languages is certainly helpful, this book starts from the basics.
D is a multi-paradigm system programming language that combines a wide range of powerful programming concepts from the lowest to the highest levels. It has C-like syntax and static typing. It pragmatically combines efficiency, control, and modeling power, with safety and programmer productivity in mind.
Each chapter is based on the contents of the previous ones, introducing as few new concepts as possible. It is recommended that the book is read in linear fashion, without skipping chapters if possible.
Although this book was written with beginners in mind, it covers almost all features of D. More experienced programmers can use the book as a D language reference by starting from the index section.
Blurbs from the back cover:
"D is pristine, clean, immensely powerful, and arguably the actual state-of-the-art programming language. Ali's book is a gem. Clear, concise, and complete." - Olivier Henley
"I have been using Ali's online D book to teach D at the university level. It is up-to-date, complete, and most importantly, extremely readable. Having a print version is even better! This is now the 'go-to' book for learning D programming." - Chuck Allison, Professor and Chair, Computer Science Department, Utah Valley University
"Ali's explanations are succinct and on target. I like that he provides rationale for why D was designed in a particular way and how I can use it most effectively. This is the best computer language book I've read." - Robbin Carlson, Luthier and Enterprise Architect
"I taught a CS2 Data Structures class in D with more success and student appreciation than when using either C++ or Java as it's an ideal language to express the relevant concepts at all scales, from detailed to big picture, without needless complexity. Ali Çehreli's tutorial played a central role supporting students especially during the first half of the course -- without it the course simply would not have worked, so "many thanks Ali" -- and an important part of that is its linearity -- it can be read with only backward dependencies. This meant that with hard work even students of little experience and only moderate current abilities could get up to speed, and we saw just that. It is hard to overstate this factor. I unreservedly recommend this book to all." - Dr. Carl Sturtivant, University of Minnesota Department of Computer Science & Engineering
"This book is one of the best guides through the language that I've seen." - Andrew Wray, D Enthusiast
"I encourage anyone considering D to read this book. Not exactly 'D for Dummies' but it's easy to follow even if you don't have much experience with compiled languages." - bachmeier, Reddit user
"Having worked through the book, I have to say this is one of the easiest to follow and distraction free read there is and the fact that it made learning a new language a total breeze really impressed me." - Imran Khan, Student