Scala for the Impatient

Bug Report Page

.

How to Tell which Printing You Have

On the bottom of the copyright page (facing the first page of the table of contents), look for a line such as
First printing, March 2012

In the errata below, we indicate the printing in which the error has been fixed inside square brackets such as [4].

For example, suppose you have the fourth printing. Then you can ignore all reports that are prefixed with [2], [3] or [4]. But you would want to pay attention to all reports that are prefixed with [5] or higher or that have no bracketed prefix at all.

Inside cover
Change “Traits can't have constructors” to “Traits can't have constructor parameters”
Page 4
The cross-reference has extra text in the section title. It should be Section 1.1, “The Scala Interpreter”
Page 15
Change “Then it gets confused about else -1.” to “Then it gets confused about the else keyword.”
Page 32
Change
for (elem <- a if a % 2 == 0) yield 2 * elem

to

for (elem <- a if elem % 2 == 0) yield 2 * elem
Page 33
Change “Given a sequence of integers” to “Given an array buffer of integers”
Page 33
After “First collect the indexes to keep:”, change var first = false to var first = true
Page 34
Change
val bSorted = b.sorted(_ < _)
   // b is unchanged; bSorted is ArrayBuffer(1, 2, 7, 9)

to

val bSorted = b.sorted // b is unchanged; bSorted is ArrayBuffer(1, 2, 7, 9)

Change “You pass the comparison function as a parameter—see Chapter 12 for the function syntax.” to

You can also supply a comparison function, but then you use the sortWith method:

val bDescending = b.sortWith(_ > _) // ArrayBuffer(9, 7, 2, 1)

See Chapter 12 for the function syntax.

Page 53

The cross-reference has extra text in the section title. It should be Section 5.1, “Simple Classes and Parameterless Methods”

Page 66

The cross-reference has extra text in the section title. It should be Section 6.3, “Objects Extending a Class or Trait”

Page 86
Change “Unlike Java, you” to “You”. After “(See Section 8.6, “Overriding Fields,” on page 89 for overriding fields.)” add “Note that this is different from Java, where a final field is immutable, similar to val in Scala.
Page 119
In the figure, change max to maxLength
Page 158
In the figure, change Iterable to Seq
Page 191
Change head: B to head: E

Change unapply(result) to unapply(lst)

Page 196 Exercise 14.1
Change alls? thr to [Ff]alls? thr
Page 196 Exercise 14.4
Change Product to Article
Page 197 Exercise 14.10
Change sqrt(Double) to sqrt(x)
Page 210
Change Comparable[Student] to Comparator[Student]
Page 211
Change Comparable to Comparator (2x)
Page 225
Change XML.save(writer, root, "UTF-8", false, null) to XML.write(writer, root, "UTF-8", false, null)
Page 234
Change

It requires that there is an “implicit value” of type T[M].

to

It requires that there is an “implicit value” of type M[T].

Page 235
Change
T <: Upper >: Lower

to

T >: Lower <: Upper
Page 239
Change foldLeft[B](z: B)(op: (A, B) => B): B to foldLeft[B](z: B)(op: (B, A) => B): B
Page 238
Change

// You can write the second parameter as find: Person => Person

to

// You can write the second parameter as find: Student => Person

Page 242 Exercise 17.9
Change “in a Pair[T]” to “in a Pair[+T].”
Page 246
Change “Given any value v” to “Given any reference v”
Page 246
Change “a method that takes an Object instance as parameter” to ““a method that takes an object instance as parameter”
Page 250
Change “For example, this method has a structural type parameter: x” to “For example, this method has a structural type parameter: target
Page 257
Change abstract trait to trait (2x)
Page 259
Change
trait ActionListener {

to

trait ActionListener extends Listener {
Page 262
Change
object ButtonModule extends ListenerSupport
{

to

object ButtonModule extends ListenerSupport {
Page 263
Change
class Buffer[E] extends Iterable[E]

to

class Buffer[E] extends Iterable[E] {
Page 273
Change “because there are no * or /” to “because there is no *
Page 294/295
Change val c = new Channel to val channel = new Channel (2x). Change case !(c, x) =>  to case !(channel, x) =>
Page 295
Change “by using the ?! operator” to “by using the !? operator”
Page 297
Change “The partial function associated with react never returns a value” to “ “The partial function associated with the first react never returns a value””
Page 300
Change “you can change that behavior handler” to “you can change that behavior”
Page 303
Change javax.imageio.IOImage.read to javax.imageio.ImageIO.read
Page 311
Change “It requires that there is an implicit value of type T[M] in scope.” to “It requires that there is an implicit value of type M[T] in scope.”
Page 316 Exercise 3
Change the exercise to  “Define a ! operator that computes the factorial of an integer. For example, 5! is 120. You will need an enrichment class and an implicit conversion.”
Page 331
Remove the line
    textField.setEnabled(false)
      

Thanks to Stephyn Butcher, Rob Dickens, Stephen Eldridge, Ersin Er, Dominik Gruntz, Matt Hurne, Jessica Kerr, William King, Alina Kirsanova, Vladimir Nikolaev, Daniel Sobral, Philip Watson, and (your name might go here) for their bug reports and suggestions!

Bug Report Form

Please use this form to report any bugs that you find. Please check the list of known bugs first before you report a bug. Unfortunately, I do not have the time to respond personally to every report, but I do read them all and will post updates to this page. Thank you!

Your name:

Your email address:

Page number:

Problem description:

To protect against spam robots, please answer this simple math problem:
* =