Foreword to the First Edition |
|
xix | |
Preface |
|
xxi | |
About the Author |
|
xxv | |
|
|
1 | (16) |
|
1.1 The Sea la Interpreter |
|
|
1 | (3) |
|
1.2 Declaring Values and Variables |
|
|
4 | (1) |
|
|
5 | (2) |
|
1.4 Arithmetic and Operator Overloading |
|
|
7 | (1) |
|
1.5 More about Calling Methods |
|
|
8 | (1) |
|
|
9 | (2) |
|
|
11 | (6) |
|
|
14 | (3) |
|
2 Control Structures And Functions A1 |
|
|
17 | (22) |
|
2.1 Conditional Expressions |
|
|
18 | (2) |
|
2.2 Statement Termination |
|
|
20 | (1) |
|
2.3 Block Expressions and Assignments |
|
|
21 | (1) |
|
|
22 | (1) |
|
|
23 | (2) |
|
2.6 More about the for Loop |
|
|
25 | (2) |
|
|
27 | (2) |
|
2.8 Default and Named Arguments L1 |
|
|
29 | (1) |
|
2.9 Variable Arguments L1 |
|
|
30 | (1) |
|
|
31 | (1) |
|
2.11 Functions without Parameters |
|
|
31 | (1) |
|
|
32 | (1) |
|
|
33 | (6) |
|
|
36 | (3) |
|
|
39 | (12) |
|
|
39 | (1) |
|
3.2 Variable-Length Arrays: Array Buffers |
|
|
40 | (1) |
|
3.3 Traversing Arrays and Array Buffers |
|
|
41 | (1) |
|
|
42 | (2) |
|
|
44 | (1) |
|
|
45 | (1) |
|
3.7 Multidimensional Arrays |
|
|
46 | (1) |
|
3.8 Interoperating with Java |
|
|
47 | (4) |
|
|
48 | (3) |
|
4 Maps, Options, And Tuples A1 |
|
|
51 | (12) |
|
|
52 | (1) |
|
|
52 | (1) |
|
|
53 | (1) |
|
|
54 | (1) |
|
4.5 Linked and Sorted Maps |
|
|
54 | (1) |
|
4.6 Interoperating with Java |
|
|
55 | (1) |
|
|
56 | (1) |
|
|
57 | (2) |
|
|
59 | (4) |
|
|
59 | (4) |
|
|
63 | (14) |
|
5.1 Simple Classes and Parameterless Methods |
|
|
63 | (2) |
|
5.2 Properties with Getters and Setters |
|
|
65 | (2) |
|
5.3 Properties with Only Getters |
|
|
67 | (1) |
|
|
68 | (1) |
|
5.5 Auxiliary Constructors |
|
|
69 | (1) |
|
5.6 The Primary Constructor |
|
|
70 | (3) |
|
|
73 | (4) |
|
|
74 | (3) |
|
6 Objects And Enumerations A1 |
|
|
77 | (8) |
|
|
78 | (1) |
|
|
78 | (1) |
|
6.3 Objects Extending a Class or Trait |
|
|
79 | (1) |
|
|
80 | (1) |
|
|
81 | (1) |
|
|
81 | (4) |
|
|
83 | (2) |
|
7 Packages, Imports, And Exports A1 |
|
|
85 | (12) |
|
|
86 | (1) |
|
7.2 Package Scope Nesting |
|
|
87 | (1) |
|
7.3 Chained Package Clauses |
|
|
88 | (1) |
|
|
88 | (1) |
|
7.5 Package-Level Functions and Variables |
|
|
89 | (1) |
|
|
89 | (1) |
|
|
90 | (1) |
|
7.8 Imports Can Be Anywhere |
|
|
91 | (1) |
|
7.9 Renaming and Hiding Members |
|
|
91 | (1) |
|
|
92 | (1) |
|
|
92 | (5) |
|
|
93 | (4) |
|
|
97 | (20) |
|
|
98 | (1) |
|
|
98 | (1) |
|
8.3 Type Checks and Casts |
|
|
99 | (1) |
|
8.4 Superclass Construction |
|
|
100 | (1) |
|
|
101 | (1) |
|
|
101 | (1) |
|
|
102 | (1) |
|
|
102 | (2) |
|
8.9 Open and Sealed Classes |
|
|
104 | (1) |
|
8.10 Protected Fields and Methods |
|
|
105 | (1) |
|
|
105 | (1) |
|
8.12 The Scala Inheritance Hierarchy |
|
|
106 | (3) |
|
|
109 | (1) |
|
8.14 Multiversal Equality L2 |
|
|
110 | (1) |
|
|
111 | (6) |
|
|
112 | (5) |
|
9 Files And Regular Expressions A1 |
|
|
117 | (12) |
|
|
118 | (1) |
|
|
118 | (1) |
|
9.3 Reading Tokens and Numbers |
|
|
119 | (1) |
|
9.4 Reading from URLs and Other Sources |
|
|
120 | (1) |
|
|
120 | (1) |
|
|
120 | (1) |
|
|
121 | (1) |
|
|
122 | (2) |
|
|
124 | (2) |
|
9.10 Regular Expression Groups |
|
|
126 | (3) |
|
|
126 | (3) |
|
|
129 | (20) |
|
10.1 Why No Multiple Inheritance? |
|
|
129 | (2) |
|
10.2 Traits as Interfaces |
|
|
131 | (1) |
|
10.3 Traits with Concrete Methods |
|
|
132 | (1) |
|
10.4 Traits for Rich Interfaces |
|
|
133 | (1) |
|
|
133 | (1) |
|
|
134 | (1) |
|
10.7 Overriding Abstract Methods in Traits |
|
|
135 | (1) |
|
10.8 Concrete Fields in Traits |
|
|
136 | (1) |
|
10.9 Abstract Fields in Traits |
|
|
137 | (1) |
|
10.10 Trait Construction Order |
|
|
138 | (1) |
|
10.11 Trait Constructors with Parameters |
|
|
139 | (1) |
|
10.12 Traits Extending Classes |
|
|
140 | (1) |
|
10.13 What Happens under the Hood |
|
|
141 | (2) |
|
10.14 Transparent Traits L2 |
|
|
143 | (1) |
|
|
143 | (6) |
|
|
145 | (4) |
|
|
149 | (20) |
|
|
150 | (1) |
|
|
151 | (1) |
|
|
152 | (1) |
|
11.4 Assignment Operators |
|
|
153 | (1) |
|
|
153 | (1) |
|
|
154 | (1) |
|
11.7 The apply and update Methods |
|
|
155 | (1) |
|
11.8 The unapply Method L2 |
|
|
155 | (2) |
|
11.9 The unapplySeq Method L2 |
|
|
157 | (1) |
|
11.10 Alternative Forms of the unapply and unapplySeq Methods L3 |
|
|
158 | (1) |
|
11.11 Dynamic Invocation L2 |
|
|
159 | (3) |
|
11.12 Typesafe Selection and Application L2 |
|
|
162 | (7) |
|
|
163 | (6) |
|
12 Higher-Order Functions L1 |
|
|
169 | (14) |
|
|
170 | (1) |
|
|
170 | (1) |
|
12.3 Parameters That Are Functions |
|
|
171 | (1) |
|
|
172 | (1) |
|
12.5 Useful Higher-Order Functions |
|
|
173 | (1) |
|
|
174 | (1) |
|
12.7 Interoperability with Lambda Expressions |
|
|
175 | (1) |
|
|
176 | (1) |
|
12.9 Methods for Composing, Currying, and Tupling |
|
|
177 | (1) |
|
12.10 Control Abstractions |
|
|
178 | (1) |
|
|
179 | (4) |
|
|
180 | (3) |
|
|
183 | (26) |
|
13.1 The Main Collections Traits |
|
|
184 | (1) |
|
13.2 Mutable and Immutable Collections |
|
|
185 | (2) |
|
|
187 | (1) |
|
|
188 | (1) |
|
|
189 | (1) |
|
13.6 Operators for Adding or Removing Elements |
|
|
190 | (3) |
|
|
193 | (2) |
|
|
195 | (2) |
|
13.9 Reducing, Folding, and Scanning A3 |
|
|
197 | (3) |
|
|
200 | (1) |
|
|
201 | (1) |
|
|
202 | (2) |
|
13.13 Interoperability with Java Collections |
|
|
204 | (5) |
|
|
205 | (4) |
|
|
209 | (22) |
|
|
210 | (1) |
|
|
211 | (1) |
|
14.3 Variables in Patterns |
|
|
211 | (1) |
|
|
212 | (1) |
|
|
213 | (1) |
|
14.6 Matching Arrays, Lists, and Tuples |
|
|
214 | (2) |
|
|
216 | (1) |
|
14.8 Patterns in Variable Declarations |
|
|
217 | (1) |
|
14.9 Patterns in for Expressions |
|
|
218 | (1) |
|
|
219 | (2) |
|
14.11 Matching Nested Structures |
|
|
221 | (1) |
|
|
222 | (1) |
|
14.13 Parameterized Enumerations |
|
|
223 | (1) |
|
14.14 Partial Functions A3 |
|
|
224 | (1) |
|
14.15 Infix Notation in case Clauses L2 |
|
|
225 | (6) |
|
|
226 | (5) |
|
|
231 | (14) |
|
15.1 What Are Annotations? |
|
|
232 | (1) |
|
15.2 Annotation Placement |
|
|
232 | (1) |
|
15.3 Annotation Arguments |
|
|
233 | (1) |
|
15.4 Annotations for Java Features |
|
|
234 | (2) |
|
|
234 | (1) |
|
|
234 | (1) |
|
15.4.3 Checked Exceptions |
|
|
235 | (1) |
|
15.4.4 Variable Arguments |
|
|
235 | (1) |
|
|
236 | (1) |
|
15.5 Annotations for Optimizations |
|
|
236 | (2) |
|
|
236 | (2) |
|
|
238 | (1) |
|
15.6 Annotations for Errors and Warnings |
|
|
238 | (1) |
|
15.7 Annotation Declarations |
|
|
239 | (6) |
|
|
241 | (4) |
|
|
245 | (18) |
|
16.1 Running Tasks in the Future |
|
|
246 | (2) |
|
|
248 | (1) |
|
|
249 | (1) |
|
|
250 | (1) |
|
16.5 Composing Future Tasks |
|
|
251 | (2) |
|
16.6 Other Future Transformations |
|
|
253 | (2) |
|
16.7 Methods in the Future Object |
|
|
255 | (2) |
|
|
257 | (1) |
|
|
258 | (5) |
|
|
259 | (4) |
|
|
263 | (2) |
|
|
264 | (1) |
|
|
264 | (1) |
|
1 7.3 Bounds for Type Variables |
|
|
265 | (12) |
|
|
266 | (1) |
|
17.5 The CI assTag Context Bound |
|
|
267 | (1) |
|
|
267 | (1) |
|
|
267 | (1) |
|
|
268 | (2) |
|
17.9 Co-and Contravariant Positions |
|
|
270 | (1) |
|
17.10 Objects Can't Be Generic |
|
|
271 | (1) |
|
|
272 | (1) |
|
17.12 Polymorphic Functions |
|
|
273 | (4) |
|
|
274 | (3) |
|
|
277 | (18) |
|
|
277 | (1) |
|
|
278 | (1) |
|
|
279 | (2) |
|
|
281 | (2) |
|
|
283 | (1) |
|
18.6 The Singleton Type Operator |
|
|
284 | (2) |
|
|
286 | (1) |
|
|
287 | (2) |
|
18.9 Abstract Type Bounds |
|
|
289 | (6) |
|
|
290 | (5) |
|
19 Contextual Abstractions L3 |
|
|
295 | (22) |
|
|
296 | (1) |
|
19.2 More about Context Parameters |
|
|
297 | (2) |
|
19.3 Declaring Given Instances |
|
|
299 | (2) |
|
19.4 Givens in for and match Expressions |
|
|
301 | (1) |
|
|
302 | (1) |
|
|
303 | (1) |
|
19.7 Where Extension Methods Are Found |
|
|
304 | (2) |
|
19.8 Implicit Conversions |
|
|
306 | (1) |
|
19.9 Rules for Implicit Conversions |
|
|
307 | (1) |
|
19.10 Importing Implicit Conversions |
|
|
308 | (1) |
|
|
309 | (2) |
|
|
311 | (1) |
|
19.13 The @implicit Not Found Annotation |
|
|
312 | (5) |
|
|
313 | (4) |
|
20 Type-Level Programming L3 |
|
|
317 | (26) |
|
|
318 | (1) |
|
|
319 | (3) |
|
20.3 Literal Type Arithmetic |
|
|
322 | (1) |
|
|
323 | (3) |
|
|
326 | (2) |
|
|
328 | (2) |
|
20.7 Type Class Derivation |
|
|
330 | (2) |
|
|
332 | (2) |
|
|
334 | (1) |
|
20.10 A Brief Introduction into Macros |
|
|
335 | (8) |
|
|
339 | (4) |
Index |
|
343 | |