Skip to content

Wrong order of sections in chapter "case class" of scala book #1677

Closed
@marcelo-rosa

Description

@marcelo-rosa

I think Section No mutator methods should be moved after Section An apply method means you don’t need new, since the example of the first section requires the user have seen the example of the second section.

Or, you cannot execute

scala> christina.name
res0: String = Christina

// can't mutate the `name` field
scala> christina.name = "Fred"
<console>:10: error: reassignment to val
       christina.name = "Fred"

without having executed

scala> case class Person(name: String, relation: String)
defined class Person

// "new" not needed before Person
scala> val christina = Person("Christina", "niece")
christina: Person = Person(Christina,niece)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions