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.
Version |
Location |
Description |
Submitted By |
Date submitted |
Date corrected |
Printed |
Page Back cover of print edition
last paragraph on the left-hand side |
A reader pointed this out to me. It looks like the paragraph might be from "Mining the Social Web", which uses iPython notebooks. How about this rewrite:
The example source code for this book is maintained in a public github repository.
Add the URL? (There isn't one in the current paragraph.) Should there be more in this paragraph?
|
Dean Wampler |
Dec 17, 2014 |
Mar 27, 2015 |
|
Chapter 4, Matching on Case Classes |
In code: // src/main/scala/progscala2/patternmatching/match-deep.sc
There is a missing right parenthesis at the line:
case Person("Alice", 25, Address(_, "Chicago", _) => println("Hi Alice!")
Note from the Author or Editor: Good catch. Should be:
case Person("Alice", 25, Address(_, "Chicago", _)) => println("Hi Alice!")
|
Eric B |
Feb 21, 2015 |
Mar 27, 2015 |
|
Chapter 1, Zero to Sixty: Introducing Scala, A Taste of Scala |
Immediately following the last "NOTE" box in this section, the text reads:
"The first code line in the file defines the package for the type, named intro."
This refers to the listing for upper1.scala. In the listing shown, however, the package is named introscala.
Note from the Author or Editor: Correct. Should be "... named introscala."
|
James Kubecki |
Feb 22, 2015 |
Mar 27, 2015 |
PDF |
Page ii
Middle of Page |
Now reads:
Revision History for the <em>First</em> Edition:
2014-11-25: First release
2015-03-27: Second release
Should read:
Revision History for the <strong>Second</strong> Edition:
2014-11-25: First release
2015-03-27: Second release
|
CMUboy |
Apr 13, 2015 |
Aug 11, 2017 |
|
Call my name, call by value
TryCatchArm.scala |
manage[R,T].apply() returns "Any", not "T".
The code example ignores the return value of "T", but the example would be more useful if it returned a type related to "T", like Option[T],Try[T].or Either.
Thanks! Nice book.
Note from the Author or Editor: There are a few improvement required:
1. "apply" should be declared to return "T".
2. The catch close should rethrow the exception. Otherwise, apply doesn't type check.
The try clause does return a T, from the call to f(res.get).
Here is an improved version of the file:
// src/main/scala/progscala2/rounding/TryCatchArm.scala
package progscala2.rounding
import scala.language.reflectiveCalls
import scala.util.control.NonFatal
// DeanW (Dec. 21, 2015): Refined the implementation and the usage
// example below to more clearly indicate the handling of the returned
// object of type T.
object manage {
def apply[R <: { def close():Unit }, T](resource: => R)(f: R => T): T = {
var res: Option[R] = None
try {
res = Some(resource) // Only reference "resource" once!!
f(res.get) // Return the T instance
} catch {
case NonFatal(ex) =>
println(s"manage.apply(): Non fatal exception! $ex")
throw ex
} finally {
if (res != None) {
println(s"Closing resource...")
res.get.close
}
}
}
}
object TryCatchARM {
/** Usage: scala rounding.TryCatch filename1 filename2 ... */
def main(args: Array[String]) = {
val sizes = args map (arg => returnFileLength(arg))
println("Returned sizes: " + (sizes.mkString(", ")))
}
import scala.io.Source
def returnFileLength(fileName: String): Int = {
println() // Add a blank line for legibility
manage(Source.fromFile(fileName)) { source =>
val size = source.getLines.size
println(s"file $fileName has $size lines")
if (size > 200) throw new RuntimeException(s"Big file: $fileName!")
size
}
}
}
|
Michael Albert |
Dec 21, 2015 |
Aug 11, 2017 |
|
Page 1
1. Zero to Sixty: Introducing Scala, A Taste of Concurrency; ShapesDrawingActor.scala (first line of case Exit) and ShapesActorDriver.scala (first line of case Finished) |
Both of these lines read println(s"ShapesDrawingDriver: cleaning up...") — if the string is a literal and no interpolation is to be performed, why is it prefixed with "s"?
Note from the Author or Editor: You are right; there is no need for the "s" here. Copy-paste error probably ;)
|
Martin Greenberg |
Jan 04, 2019 |
|
Printed |
Page 6
3rd paragraph |
No mistake in the book but in the projectcode from github.
After running the help and eclipse tasks, importing of the code examples in Eclipse didn't succeed because the colon in the projectname (after "Second Edition") was not accepted. I had to remove it first in the xml.
Note from the Author or Editor: I changed the project name in the github repo's "build.sbt". It should now work.
|
Hans de Jong |
Feb 08, 2015 |
Mar 27, 2015 |
Printed |
Page 11
top |
scala Upper1
should instead be
scala -cp . Upper1
Note from the Author or Editor: This appears to be platform dependent, but it's a fine default.
|
Anonymous |
Nov 22, 2015 |
Aug 11, 2017 |
PDF |
Page 16
6th (second to last) |
"Because map takes a single function argument, where the function itself takes a single argument." is a clause. I think removing the leading "Because" will fix it.
Note from the Author or Editor: Yes, change "Because" to "The".
|
Chris Simpkins |
Aug 23, 2014 |
Nov 25, 2014 |
PDF |
Page 18
1st paragraph, 4th line |
s/imaging/imagine/
Note from the Author or Editor: correct
|
Chris Simpkins |
Aug 23, 2014 |
Nov 25, 2014 |
PDF |
Page 21
1 |
The package in the scala code Shapes.scala is defined as
package progscala2.introscala.shapes
However in page 21 the code states
import progscala2.intro.shapes._
import progscala2.intro.shapes._
as you can see progscala2.intro != progscala2.introscala
As a result the code in the book will not work.
I apologize for selecting serious technical mistake when it may be a simple problem.
But for new people learning the language, it may be frustrating. :)
Thank you and more power.
Note from the Author or Editor: The line on page 21:
scala> import progscala2.intro.shapes._
should be
scala> import progscala2.introscala.shapes._
|
Cyrus Cempron |
Jun 05, 2015 |
Aug 11, 2017 |
PDF |
Page 21
code section 3rd paragraph |
scala> import progscala2.introscala.shapes._
import progscala2.introscala.shapes._
scala> val p00 = new Point
p00: progscala2.introscala.shapes.Point = Point(0.0,0.0)
scala> val p20 = new Point(2.0)
p20: progscala2.introscala.shapes.Point = Point(2.0,0.0)
scala> val p20b = new Point(2.0)
p20b: progscala2.introscala.shapes.Point = Point(2.0,0.0)
scala> val p02 = new Point(y = 2.0)
p02: progscala2.introscala.shapes.Point = Point(0.0,2.0)
scala> p00 == p20
res0: Boolean = false
scala> p20 == p20b
res1: Boolean = true
Note from the Author or Editor: Correct. The initial import statement and the "echo" on the next line should have "progscala2." prefixes. I found some other mistakes like this that I'll email to the production team, as well.
|
Vincent Ohprecio |
Aug 31, 2014 |
Nov 25, 2014 |
PDF |
Page 22
2nd paragraph, last sentence |
s/to to/to do/
Note from the Author or Editor: correct.
|
Chris Simpkins |
Aug 23, 2014 |
Nov 25, 2014 |
PDF |
Page 33
Person Example |
The Person class example given on page 33 is correct.
But the code in the git repository says:
// src/main/scala/progscala2/typelessdomore/person.sc
says class Person(val mame: String, var age: Int)
note name is typed as mame, while later in the same file it is referred as name..
Note from the Author or Editor: Yes, it should be "name".
|
Anonymous |
Jan 17, 2016 |
Aug 11, 2017 |
PDF |
Page 34
First line |
s/can want to/can/
Note from the Author or Editor: Doh! correct
|
Chris Simpkins |
Aug 24, 2014 |
Nov 25, 2014 |
PDF |
Page 35
4th and 5th paragraphs in the Partial Functions section |
"This function avoids the risk of throwing a MathError exception..."
'MathError' should probably be MatchError
"A MathError is only thrown..."
Same here
Note from the Author or Editor: Damn. It should be MatchError.
|
Anonymous |
Dec 07, 2014 |
Mar 27, 2015 |
Printed |
Page 37
3rd and 4th paragraphs under Partial Functions section |
The text shows MathError when it should show MatchError
Note from the Author or Editor: yes.
|
Stephen Souness |
Jun 29, 2015 |
Aug 11, 2017 |
PDF |
Page 41
3rd paragraph |
The signature of onSuccess function is incorrect.
Book:
def onSuccess[U](func: (Try[T]) => U)( implicit executor: ExecutionContext): Unit
Scala SDK:
def
onSuccess[U](pf: PartialFunction[T, U])(implicit executor: ExecutionContext): Unit
Note from the Author or Editor: That's correct. I don't where I got the signature shown in the book.
|
Andrey Myatlyuk |
May 07, 2015 |
Aug 11, 2017 |
Printed, PDF, ePub |
Page 42
Factorial example |
The factorial example on page 42:
// src/main/scala/progscala2/typelessdomore/factorial.sc
def factorial(i: Int): Long = {
def fact(i: Int, accumulator: Int): Long = {
if (i <= 1) accumulator
else fact(i - 1, i * accumulator)
}
fact(i, 1)
}
(0 to 5) foreach ( i => println(factorial(i)) )
As explained in the book (for the return type) "We used Long because factorials grow in size quickly".
However this won't work because the "fact" method accepts only Int which will truncate the Long to Int, resulting in negative factorials. For example run this example with range 0 to 20 ( (0 to 20) foreach ( i => println(factorial(i)) )
I think accumulator should be of type Long:
def factorial (i: Int): Long = {
def fact(i: Int, accumulator: Long): Long = {
if (i <= 1) accumulator
else fact (i - 1, i * accumulator)
}
fact (i, 1)
}
This way it will for range "0 to 20" (but not beyond that as it goes outside Long range :) )
Note from the Author or Editor: Ah, yes. You're right. the "accumulator" argument to "fact" should be "Long", not "Int".
|
Anonymous |
Jan 19, 2016 |
Aug 11, 2017 |
PDF |
Page 46
Code Example |
On page 46, line 5 (excluding white spaces) of the formatted code example should be p.age and not p.lastName
Note from the Author or Editor: Correct. It should be "p.age". Copy, paste error...
|
Ajeya Vempati |
Jun 01, 2014 |
Nov 25, 2014 |
PDF |
Page 50
5th Paragraph |
In the section, "Methods with Multiple Argument Lists", in page 51, the author starts the last paragraph with "The third advantage ...".
Am I missing another advantage #2? I am assuming advantage #1 is being able to use the 'syntactic sugar' advantage of being able to use '{}' vs '()'.
Note from the Author or Editor: Yes, no explicit "second" advantage is mentioned. I've "renumbered" them to have a total of 3, not 4.
|
Anonymous |
Jun 01, 2014 |
Nov 25, 2014 |
PDF |
Page 55
3rd Paragraph |
The last sentence in paragraph 3 reads as "Fortunately, Java 8 finally adds clojures to Java.". I think, this is what the author meant "Fortunately, Java 8 finally adds closures to Java."
Note from the Author or Editor: Doh! Yes, "closures" is the correct work.
|
Anonymous |
Jun 01, 2014 |
Nov 25, 2014 |
PDF |
Page 60
First line under heading Option, Some, and None: Avoiding nulls |
s/three useful type/three useful types/ (add an 's' to "type").
Note from the Author or Editor: Correct.
|
Chris Simpkins |
Aug 24, 2014 |
Nov 25, 2014 |
Printed |
Page 85
3rd paragrap |
whether or not the we process the files
should be
whether or not we process the files
Note from the Author or Editor: Yes, delete the "the".
|
Stephen Souness |
Jun 30, 2015 |
Aug 11, 2017 |
PDF |
Page 97
3rd paragraph |
"enhancment" should be "enhancement".
Note from the Author or Editor: correct
|
Fatih Ergüven |
Jun 22, 2015 |
Aug 11, 2017 |
PDF |
Page 98
source code - object manage |
In code snippet of apply manage val/val error.
Resource close never because symbol 'res' define two time in different scope:
var res: Option[R] = None // first time as mutable
val res = Some(resource) // second time as immutable in try scope...
In 'finally' scope using 'var res' which is never 'None'.
Note from the Author or Editor: Correct. The "val res = Some... should not have the "val". Fixed in the next early-access release.
|
Andrew Rochev |
Aug 12, 2014 |
Nov 25, 2014 |
Printed, PDF, ePub |
Page 104
First Example on the page |
The example:
for {
x <- Seq(1, 2, 2.7, "one", "two", 'four)
} {
val str = x match {
case _: Int | _: Double => "a number: "+x
case "one"
=> "string one"
case _: String
=> "other string: "+x
case _
=> "unexpected value: " + x
}
println(str)
}
point to file // src/main/scala/progscala2/patternmatching/match-variable2.sc
Actually this code is in the file // src/main/scala/progscala2/patternmatching/match-variable3.sc
same needs to be updated in match-variable3.sc file in the comment.
Note from the Author or Editor: Correct. The comment should say match-variable3.sc
|
Anonymous |
Jan 23, 2016 |
Aug 11, 2017 |
Printed, PDF, ePub |
Page 109
Example of Matching on case Classes |
The case of "Alice" is missing last closing parentheses both in book and and git source i.e.
case Person("Alice", 25, Address(_, "Chicago", _) => println("Hi Alice!")
should be:
case Person("Alice", 25, Address(_, "Chicago", _) => println("Hi Alice!"))
Note from the Author or Editor: Actually the lasted printing has it right. There's a missing paren before the "=>". It should be:
case Person("Alice", 25, Address(_, "Chicago", _)) => println("Hi Alice!")
(not after the println). I just pushed a fix to the github source, too.
|
Anonymous |
Jan 25, 2016 |
Aug 11, 2017 |
Printed, PDF, ePub, Mobi, , Other Digital Version |
Page 113
infix example |
The github source is missing the file src/main/scala/progscala2/patternmatching/infix.sc.
Note from the Author or Editor: This file was actually in src/main/scala/progscala2/rounding. I moved it to patternmatching in the Github repo, so no change to the book's text is required.
|
Anonymous |
Jan 25, 2016 |
Aug 11, 2017 |
Printed, PDF, ePub, Mobi |
Page 118
match-regex example |
The $ is missing for title in println for MagazineExtractorRE i.e.
case MagazineExtractorRE(title, issue) => println(s"""Magazine "title", issue $issue""")
should be
case MagazineExtractorRE(title, issue) => println(s"""Magazine "$title", issue $issue""")
Note from the Author or Editor: Correct, the source file is missing the $ as shown. I've fixed the source in the Git repo.
|
Anonymous |
Jan 25, 2016 |
Aug 11, 2017 |
PDF |
Page 132
Result of code snippet |
This string "list double" is in result of code snippet page 132. But this string in not in code. It is copy past error.
Note from the Author or Editor: Correct. Will fix in final version.
|
Andrew Rochev |
Jul 23, 2014 |
Nov 25, 2014 |
Printed |
Page 141
After second paragraph |
You say:
==============
So, the following two expressions are equivalent:
<:<(A, B)
A <:< B
In toMap, the B is really a pair:
<:<(A, (T,U))
A <:< (T,U)
==============
It should actually be using square brackets since we are talking about the type, not an instance. This is my attempt to correct it:
==============
So, the following two expressions are equivalent:
<:<[A, B]
A <:< B
In toMap, the B is really a pair:
<:<[A, (T,U)]
A <:< (T,U)
==============
Note from the Author or Editor: Correct.
|
Michael Knapp |
Mar 14, 2015 |
Mar 27, 2015 |
Printed |
Page 144
The first paragraph of the Improving Error Messages section |
...use map for a a custom target...
Has a redundant 'a'
Note from the Author or Editor: Yes, there's a redundant "a".
|
Stephen Souness |
Jul 01, 2015 |
Aug 11, 2017 |
PDF |
Page 150
1st paragraph |
The overridingConversion code could not be found
Note from the Author or Editor: The wrong source file was included here (i.e., the previous file was included in the text twice). There are only two changes, however:
1. The comment with the file name should end with .../implicit-conversions-resolution2.sc
2. There is a new line of text before the definition of "class O":
implicit def overridingConversion(s: String): Foo = Foo("Boo: "+s)
|
Winson Kwok |
Jan 07, 2015 |
Mar 27, 2015 |
PDF |
Page 152
end of page and beginning of page 153 |
Just a suggestion: instead of using Int and String as the markers for your examples, consider using marker classes, like so, and also mentioning why using common classes like Int and String is not a good idea:
class IntMarker
class StringMarker
object M {
def m(seq: Seq[Int])(implicit i: IntMarker): Unit =
println(s"Seq[Int]: $seq")
def m(seq: Seq[String])(implicit i: StringMarker): Unit =
println(s"Seq[String]: $seq")
}
implicit val anIntMarker = new IntMarker
implicit val aStringMarker = new StringMarker
M.m(List(1,2,3))
M.m(List("one", "two", "three"))
Note from the Author or Editor: Good idea. I changed the example accordingly.
|
Robert Yacobellis |
Aug 17, 2014 |
Nov 25, 2014 |
PDF |
Page 153
Last paragraph |
First, we won�t hande arrays or nested objects, just �flat� JSON expressions like {"a": "A", "b": 123, "c": 3.14159}
May be - First, we won�t HANDLE arrays or nested objects, .....
Note from the Author or Editor: Fixed.
|
alex.menshov.1@facebook.com |
Aug 20, 2014 |
Nov 25, 2014 |
Printed, PDF, ePub |
Page 177
First example of recursion |
The factorial-recur1.sc example in the book and github is missing "{".
def factorial(i: BigInt): BigInt =
should be
def factorial(i: BigInt): BigInt = {
Note from the Author or Editor: Correct.
|
Anonymous |
Feb 16, 2016 |
Aug 11, 2017 |
Printed, PDF, ePub |
Page 179
Partially Applied Functions Versus Partial Functions |
As mentioned curried-func.sc is not in // src/main/scala/progscala2/fp/datastructs/curried-func.sc but in // src/main/scala/progscala2/fp/curry/curried-func.sc
Note from the Author or Editor: Correct. It's in the fp/curry location.
|
Anonymous |
Feb 16, 2016 |
Aug 11, 2017 |
Printed, PDF, ePub |
Page 200
Option Reduce Example |
The example given:
List.empty[Int] optionReduce (_ + _)
should be
List.empty[Int] reduceOption (_ + _)
There is no method optionReduce on List.
Note from the Author or Editor: Yes, should be "reduceOption".
|
Anonymous |
Feb 18, 2016 |
Aug 11, 2017 |
Printed |
Page 209
4th paragraph |
foldLeft and foldRight are mentioned, but the accompanying code sample implements reduceLeft and reduceRight.
Note from the Author or Editor: Correct. The text before the example should say reduceLeft and reduceRight
|
Stephen Souness |
Jul 05, 2015 |
Aug 11, 2017 |
PDF |
Page 226
|
actual:
sealed abstract class Option[+T]
should be
sealed abstract class Option[+A]
as A is used in the methods signature
Note from the Author or Editor: Ah, good catch. Yes, should be "+A".
|
Mario Paniccia |
Oct 19, 2015 |
Aug 11, 2017 |
Printed |
Page 227
Second code sample |
The comment mentions expr1, whereas the implementation mentions expr
Note from the Author or Editor: pg 223 in my PDF. Actually the 2nd and 3rd examples on the page have this issue. For consistency with the rest of the example, I would change the code, not the comments.
2nd example becomes: expr1 map { case pat => expr2 }
3rd example becomes: expr1 foreach { case pat => expr2 }
|
Stephen Souness |
Jul 06, 2015 |
Aug 11, 2017 |
Printed |
Page 243
First paragraph |
The first sentence mentions three distinct things, but the second paragraph starts of with "Both" as though covering only two things.
I suspect Validation was added after Either and Try but this particular text was not adjusted accordingly.
Note from the Author or Editor: Thanks for adding the extra detail. I found the issue. It's the 1st paragraph on page 239 in my PDF. Yes, instead of "both" starting the 2nd sentence, it should say "All three".
|
Stephen Souness |
Jul 06, 2015 |
Aug 11, 2017 |
Printed |
Page 243
First paragraph |
Following up on previous errata...
The paragraph begins with:
Either, Try, and Validation express through types a fuller picture of how the program actually behaves. Both say that a valid value ...
In this case I believe "Both say" should be replaced with something like "They say", since more than two subjects are involved.
Note from the Author or Editor: Thanks, confirmed after the added details in the previous bug report.
|
Stephen Souness |
Jul 06, 2015 |
Aug 11, 2017 |
Printed |
Page 246
Final paragraph |
"also call" should be "also called"
Note from the Author or Editor: Already fixed in the latest printing.
|
Stephen Souness |
Jul 06, 2015 |
Aug 11, 2017 |
Printed |
Page 248
3rd - 4th paragraphs |
The start of the fourth paragraph repeats what is stated in the third paragraph.
Note from the Author or Editor: Page 244 in my PDF. Correct. the third paragraph could be deleted completely:
If an object and a class have the same name and are defined in the same file, they are called companions.
|
Stephen Souness |
Jul 06, 2015 |
Aug 11, 2017 |
Printed |
Page 249
First paragraph |
The sample code for creating a Map is missing a value for the first entry:
Map("one" ->, "two" -> 2)
- which does not compile.
Note from the Author or Editor: 1st paragraph on pg. 245 in my PDF. Yes, it should be "Map("one" -> 1, "two" -> 2)"
|
Stephen Souness |
Jul 06, 2015 |
Aug 11, 2017 |
PDF |
Page 287
last bullet point of the page, number 4 |
Hi,
is the last bullet point( number 4) correct? it states that
cp.value = new CSuper
is a correct assignment. OK.
How can that be correct if instead
cp.value = new C
is stated not to be correct? CSuper is a super type of C, which is a super type of CSub. So if 2 if wrong then also 4 should be NOT OK
I suspect bullet point 4 should be Not OK then.
Can u please confirm this?
Kind regards,
Mario Paniccia
Note from the Author or Editor: This is a hard concept to explain and I made a mistake here. You are correct that this line is not correct, for the same reason as in the previous 4 bullet points.
So this last #4 note be the same as the previous #4 note: "Compilation error, because a CSuper instance can’t be substituted for a C instance."
There is also a typo in the explanation for #1, it should say "... declared type of cp, ..."
|
Mario Paniccia |
Oct 14, 2015 |
Aug 11, 2017 |
Printed |
Page 288, 289
last line of 288, and first line of 289 |
There appears to be markup in the text
<emphasis role="keep-together">contract</emphasis>]
Note from the Author or Editor: Wow! It's near the bottom of page 284 in my PDF. The word "contract" should be in italics/emphasis without the HTML tags.
|
Stephen Souness |
Jul 07, 2015 |
Aug 11, 2017 |
PDF |
Page 291
End of 2nd paragraph under "Much Ado About Nothing (and Null) |
The statement:
Null is implemented in the compiler as if it has the following declaration:
package scala
abstract final class Null extends AnyRef
is confusing. I understand the declaration is hypothetical, but it uses language keywords which have meanings that contradict the reality of the Null type. In particular, the hypothetical declaration says that Null's immediate superclass is AnyRef (it's not) and that, being abstract, it cannot have any instances (it does). I would avoid trying to come up with a technically correct hypothetical declaration (I tried :-) and simply say that the compiler creates the Null type as a class that extends every class that has AnyRef as its highest superclass, and a singleton object named null as the only instance of Null.
The hypothetical declaration of Nothing at the bottom of the page is similarly confusing.
Note from the Author or Editor: Yes, it's not intended to be a precise definition, as Scala doesn't provide a way to declare your own "bottom" types. I'll reword it in the 3rd edition, if there is one.
|
Chris Simpkins |
Dec 19, 2015 |
Aug 11, 2017 |
PDF |
Page 322
2nd paragraph |
The fourth line of second paragraph:
attempts to use override val name = "foo"
I think it should be
override var name = "foo"
i.e. an attempt to use var to override a parameterless method will get an error
Note from the Author or Editor: Correct, it should be "var" not "val". There is also another typo in the first sentence of the same paragraph, "... writer method, override name_=, ..." There should be a "def" between "override" and "name".
|
Winson Kwok |
Jan 08, 2015 |
Mar 27, 2015 |
Printed, PDF |
Page 328
code (src/main/scala/progscala2/basicoop/ValueClassPhoneNumber.sc) |
the source code included is :
// src/main/scala/progscala2/basicoop/ValueClassPhoneNumber.sc
But it shoud be
// src/main/scala/progscala2/objectsystem/value-class-universal-traits.sc
Note from the Author or Editor: Fixed in the Github repo.
|
enshahar |
May 26, 2015 |
Aug 11, 2017 |
PDF |
Page 332
first row |
actual:
The one implementation of collection.mutable.Map is a hash-trie class collec tion.concurrent.TrieMap
I think the author meant:
The one implementation of collection.concurrent.Map is a hash-trie class collec tion.concurrent.TrieMap
Note from the Author or Editor: Good catch!
|
Mario Paniccia |
Oct 18, 2015 |
Aug 11, 2017 |
Printed |
Page 337
Final paragraph |
"Vector is implemented using as a"
Either using or as should be removed.
Note from the Author or Editor: Yes, wording needs cleaning up.
|
Stephen Souness |
Jul 08, 2015 |
Aug 11, 2017 |
Printed |
Page 344
The line below the first code section |
..."so if we map it to a a set"...
One of the "a"s is redundant.
Note from the Author or Editor: Ah yes. Thanks.
|
Stephen Souness |
Jul 08, 2015 |
Aug 11, 2017 |
PDF |
Page 354
Code example, first method (equalsFields) |
def equalFields(other: ProtectedClass1) =
(protectedField1 == other.protectedField1) &&
(protectedField1 == other.protectedField1) &&
(nested == other.nested)
should be
def equalFields(other: ProtectedClass1) =
(protectedField1 == other.protectedField1) &&
(protectedField2 == other.protectedField2) &&
(nested == other.nested)
|
Dean Wampler |
Aug 28, 2014 |
Nov 25, 2014 |
PDF |
Page 427
last line |
The regular expression:
val blankRE = """^\s*#?\s*$""".r
is claimed to be: "a matcher for blank lines (or “comments,” lines where the first non- whitespace character is a #), which are ignored."
However any non-whitespace after a # will cause the match to fail.
I believe you intended something more like:
val blankRE = """^\s*(?:#.*)?\s*$""".r
Note from the Author or Editor: The proposed change to blankRE is what it should be.
|
Eric Wasserman |
Feb 05, 2015 |
Mar 27, 2015 |
PDF |
Page 475
Second paragraph after the table at the top of the page. |
(The page number is the printed page number in the PDF; it's the "physical" page 505.)
The sentence: "Use -encoding UTF8 if you use non-ASCII characters in names or the allowed symbols, such as ⇒ (Unicode \u21D2) instead of =>." should instead end with "... =>."
|
Dean Wampler |
Dec 19, 2015 |
Aug 11, 2017 |
PDF |
Page 482
4th paragraph |
Broken link to sbt-web in
'By now you’ve installed SBT. If you do JVM-based web development, see also the new sbt-web project"
->https://github.com/sbt/sbt-web$$
Note from the Author or Editor: The dollar signs "$$" shouldn't be at the end of the URL. I don't know how they got there.
|
Anonymous |
Jan 31, 2015 |
Mar 27, 2015 |
ePub |
Page 505
function validName |
In example for-validations-good-form.sc, the if condition in function validName should be
if (n.length > 0 && n.matches("""^\p{Alpha}+$""")) Success(List(key -> n))
instead of
if (n.length > 0 && n.matches("""^\p{Alpha}$""")) Success(List(key -> n))
The symbol "+" is missed.
Note from the Author or Editor: Yes, the + should be in the triple-quoted string: ""^\p{Alpha}+$"""
|
Raymond Shu |
Dec 19, 2015 |
Aug 11, 2017 |
Printed, PDF |
Page 517
1st paragraph |
First sentence: "... that manipulates programs, rather than data", should really read "that manipulates programs as data".
|
Dean Wampler |
Jan 05, 2015 |
Mar 27, 2015 |
Printed, PDF, ePub |
Page 517
2nd to last sentence of last paragraph |
"... we'll focus on the most stable parts: runtime reflection..." Change "runtime" to "runtime and compile-time" (drop the hyphen if you prefer...)
|
Dean Wampler |
Jan 05, 2015 |
Mar 27, 2015 |
Printed, PDF, ePub |
Page 518
last paragraph in the "Tools for ..." section |
" scala.reflect.api.Types.TypeRef and scala.reflect.api.Symbols.TypeSymbol" should be " scala.reflect.api.Types#TypeRef and scala.reflect.api.Symbols#TypeSymbol". That is, the last period in each name should be a # instead. The links work correctly, fortunately.
|
Dean Wampler |
Jan 05, 2015 |
Mar 27, 2015 |
Printed, PDF, ePub |
Page 520-522
"match-types.sc" example |
This example is actually nonsense for reasons I won't elaborate here. It would be best to remove it completely. I recommend the following changes.
1. Delete the paragraphs starting at "We saw in "More on Type Matching"..." through to the single-sentence paragraph "However, as mentioned, it's not accurate for Seq[Any] with mixed elements, the second to last example". on pages 520-521.
2. Move the example at the end of this section, mkArray.sc, in its place. Starting at the paragraph on pg. 522: "Another important usage or ClassTag ...", plus the mkArray.sc example, and finally the paragraph "It uses the Array.apply method for AnyRefs, which has a second argument list with a single implicit ClassTag argument". However, change the leading words, "Another important ..." to "An important usage..."
3. With this example moved, the last paragraphs will now be the ones I didn't mention that are unchanged:
"The compiler exploits the type information...
"Hence, ClassTags can't "resurrect" type information...
"ClassTag is actually a weaker version of ...
"Note that there are older types in the ...
<end of section>
(Actually, there is a correction for the last paragraph that I suggested in another bug report.)
|
Dean Wampler |
Jan 05, 2015 |
Mar 27, 2015 |
Printed, PDF, ePub |
Page 522
2nd sentence in the 1st full paragraph |
"These types are being deprecated." Change to "These types will be deprecated eventually."
|
Dean Wampler |
Jan 05, 2015 |
Mar 27, 2015 |
Printed, PDF, ePub |
Page 527
First sentence in the last paragraph |
"... syntax expands the list into comma-separated values" should be "... syntax expands the list into a list of trees"
|
Dean Wampler |
Jan 05, 2015 |
Mar 27, 2015 |
Printed, PDF, ePub |
Page 528
First sentence in the second paragraph |
"Recall that we said that macros are a limited form of compiler plug-in" would be more accurately put, "Recall that we said that macros work like a limited form of compiler plug-in"
|
Dean Wampler |
Jan 05, 2015 |
Mar 27, 2015 |
Printed, PDF, ePub |
Page 528
Code example under "A Macro Example..." |
The line "import reflect.runtime.universe._" should be there. (It can cause problems in some cases). So, it should be removed, but the "1" bullet should be moved to the next line, "import scala.language.experimental.macros".
|
Dean Wampler |
Jan 05, 2015 |
Mar 27, 2015 |
ePub |
Page 553
Table 10-1 |
In the table 10-1 "Type variance annotations and their meanings" the entry for contravariance contradicts the definition I have seen elsewhere.
The book shows:
-T means Contravariant. E.g., X[Tsup] is a supertype of X[T].
I have read in other sources:
-T means Contravariant. E.g., X[Tsup] is a subtype of X[T]
Which one is right?
Note from the Author or Editor: Yikes. It should say "X[Tsup] is a subtype of X[T]"
|
John Ferguson |
Nov 19, 2014 |
Nov 25, 2014 |
Mobi |
Page 999
Kindle location 15735 |
(Sorry for lack of a page number: O'Reilly should start paginating their Kindle books [hint-hint].)
In Chapter 10, section "The == and != Methods":
```
Note
In Java, C++, and C#, the == operator tests for reference, not value equality. In contrast, Scala's == operator tests for value equality.
```
In C++, the == operator must be explicitly defined for user-defined types (i.e. classes). Implementers can define equality however they want, but typically they define it to provide value equality semantics. There is no default implementation that provides reference equality semantics.
Note from the Author or Editor: Remove reference to C++
|
Anonymous |
Aug 26, 2015 |
Aug 11, 2017 |
Mobi |
Page 1177
First code block |
The source code of the first example in the "A Taste of Concurrency" section of chapter 1 shows as its first line:
src/main/scala/progscala2/introscala/shapes/Shapes.scala
but the respective file in the GitHub repository for the code is called shapes.scala, with a lowercase 's'.
|
Gianfranco Cecconi |
Aug 08, 2016 |
Aug 11, 2017 |