The Artima Developer Community


Errata for Programming in Scala, 2nd Edition
Chapter 12: Traits
Return to errata index.

Page 224 (PDF page 265):
def < seems to have the wrong symbol: should be
  def < (that: Rational) =
    this.numer * that.denom < that.numer * this.denom
Page 224 (PDF page 265):
In the code snippet there are 4 operators defined.
The text then states "...three of the comparison operators are defined in
terms of the first one..."
Thus, we are to assume that the first is < and "three" refers to the
latter of the 4 shown operators.
If this is the case then only 2 of the 3 latter operators refer to <. The
last of the 4 operators, >=, refers to >, || and == and not <.
Page 225 (PDF page 266):
The compare method for Rational is not robust as it can easily overflow. 
The same could be said for the whole of chapter 6.
Page 226 (PDF page 267):
The last paragraph of the chapter 12.4 mentions "type erasure".
Since this term wasn't mentioned previously in the book it would be
consistent with the rest of the book to add a note/link that "the type
erasure is explained in chapter 15.2" (or a footnote that briefly
explains it).

Page number: Book type: Paperback book PDF eBook
Book version: (Or build date. Found on back of title page.)
Your feedback:
Your name: (optional)
Your email address: (optional) (will not be published)

Copyright © 2021 Artima, Inc. All rights reserved.