The Artima Developer Community


Errata for Programming in Scala, 2nd Edition
Chapter 5: Basic Types and Operations
Return to errata index.

Page 75 (PDF page 119):
More of a "note for future book versions":

Leading zero octal notation is deprecated.

REPL output:
scala> val oct = 035
<console>:1:warning: Treating numbers with a leading zero as octal is
deprecated.
       val oc = 035
                ^
Page 76 (PDF page 120):
"if it were a Short" instead of "if it was a Short" in the sentence:

"If an Int literal is assigned to a variable of type Short or Byte, the
literal is treated as if it were a Short or Byte type so long..."
Page 92 (PDF page 136):
{ val x = a; b.:::(x) }

The parameter passed to the ::: method is wrong - it should be a ...

{ val x = a; b.:::(a) }
Page 134 (PDF page 178):
Explicit scala.language.postfixOps enablement not mentioned in a book.

REPL example:

scala> val r = 7 toLong
<console>:7: warning: postfix operator toLong should be enabled
by making the implicit value scala.language.postfixOps visible.
This can be achieved by adding the import clause 'import
scala.language.postfixOps' or by setting the compiler option
-language:postfixOps.
See the Scala docs for value scala.language.postfixOps for a discussion
why the feature should be explicitly enabled.
       val r = 7 toLong
                 ^
r: Long = 7

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.