The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

douglasv (316) [Avatar] Offline
#1
class MongoClient(private val _host:String, ...
Is equivalent to the class MongoClient(val host:String...

If I do not use the keyword "private" in the class parameter's definition; with the book code,
the fields are visible in my scala tool, otherwise unaccessible with private's use

var produces a mutable and val produces immutable
the private visibility...

previous page explained by example the results of private in code, but
the code being referenced did not contain the keyword "private"

I'm enjoying your book

Message was edited by:
douglasv

Message was edited by:
douglasv
lutzhank (61) [Avatar] Offline
#2
Re: pdf page 52 Great book
Bookversion 11/15/2010

You wrote
"class MongoClient(private val _host:String, private val _port:Int) ... is equivalent to the class MongoClient(val host:String, val port:Int)."

An alternative form is
"class MongoClient(_host:String, _port:Int) ... is equivalent to the class MongoClient(val host:String, val port:Int)."

But this would avoid the discussion of the private specifier. (maybe in a foot note?)
lutzhank (61) [Avatar] Offline
#3
also on page 52
Book version 11/15/2010

Additional notes:

1) Second paragraph second line:
orig:"...do is define a field..."

alternative: "...do is to define a field..."

2) Code in "How do you create a setter.." box
orig: "def age _=(..."

typo, redundant blank
suggestion: "def age_=(..."

3) Last paragraph in "How do you create a setter.." box 4th line: typo?
orig: "...different thing based on context."

suggestion: "...different things based on context"

By the way I found it very valuable to read the content of the box here at this point of reading smilie

4) Second line after box
orig: "Wouldn’t be nice to have..."

suggestion: "Wouldn’t it be nice to have"