The Artima Developer Community


Errata for Programming in Scala, 2nd Edition
Chapter 6: Functional Objects
Return to errata index.

Page 112 (PDF page 156):
In order to use implicit conversions, you need to import
scala.language.implicitConversions. Also need to start scala with flag
-feature

Environment: Win8.1 + scala 2.10.4
Page 114 (PDF page 158):
It says "In Chapter 21, you'll learn how to place implicit method
definitions in a companion object for Rational, so they can be more
easily placed into scope when client programmers are working with
Rationals".

It's true that we can place the implicit method in the companion object
of Rational, however, it does not work as one expects. Please see
explanation in
http://stackoverflow.com/questions/4569192/implicit-conversion-import-requ
ired-or-not

Actually in Chapter 21, it use the same implicit method example as the
one in page 112 for the Rational class. This confuses a beginner a lot
during study.

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 © 2024 Artima, Inc. All rights reserved.