Errata

Programming Scala

Errata for Programming Scala

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
X
Chapter 2, subsection "Methods with Multiple Parameter Lists", first sentence of third to last paragraph

(Please ignore the "Page number of error" field above. I can't find the page number when using the Safari Books Online)
Duplicate "can" in the sentence
"By the way, we can can simplify our expressions even more: str => println(str)"

Note from the Author or Editor:
Correct, the sentence should have one "can". In the PDF, this typo is on page 41 or 42.

Jian Lan  Jun 15, 2021 
Page X
The code example of the section "Case Objects and hashCode" in the chapter 11

`println(s"03.04 vs. 03: ${O3.O4.hashCode} == ${"O3".hashCode}")` should be
`println(s"03.04 vs. 03: ${O3.O4.hashCode} != ${"O3".hashCode}")`, use `!=`.

Also its output:

`03.04 vs. 03: 2501 == 2500` should be `O3.O4 vs. O3: 2501 != 2500`.

Note from the Author or Editor:
Confirmed. The error is in the strings "O3.04 vs. O4:" and "O3.04 vs. O4:". The references to variables "O3" and "O4" are correct.

Jian Lan  Jun 27, 2021 
Page Chapter 5, Scala 3 Implicit Conversions
Code that defines "toDollars"

The bullet #1 for the example that defines a method "toDollars()" refers to it as "toDollar":

1. Ask for a given function. The compiler lifts toDollar to a function.

It should be "toDollars"

Note from the Author or Editor:
Yes, the report is correct. It should be "toDollars".

Dean Wampler  Dec 18, 2022 
Page Page 56: Character Literals
2nd sentence of 1st paragraph; also '\012' example below 1st paragraph

To my knowledge, octal escape syntax for character literals in Scala has been removed (pre-Scala 3), though the text is for Scala 3 and describes them as if they are still a part of the language. Trying to use an octal escape sequence for a character literal gives a compiler error, however.

Note from the Author or Editor:
Yes, that's correct that they have been removed in Scala 3. Thanks for catching this. The sentence "A character with a Unicode value between 0 and 255 may also be represented by an octal escape; that is, a backslash (++\++) followed by a sequence of up to three octal characters." should be removed, along with the example:
```
'\n', '\012' // '\n' in octal
```

Misha Reswick  Mar 18, 2024 
Printed, PDF, ePub
Page 491

The example "Invariant1.scala" and also the subsequent example "Invariant.scala" use "by-name" parameters where they are not needed, i.e., for the "predicate" and "block" parameters. Because the methods are inlined, there is no need to use by-name parameters to delay evaluation of them until inside the method bodies. There are no method bodies after inlining, just blocks of code.

I have updated the two code files in the examples GitHub repo.

Dean Wampler
Dean Wampler
 
May 22, 2022