Skip to content

Terminology fix: case class instances #1629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _tour/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ We will cover classes in depth [later](classes.html).

## Case Classes

Scala has a special type of class called a "case" class. By default, case classes are immutable, and they are compared by value (unlike classes, which are compared by reference). This makes them additionally useful for [pattern matching](https://docs.scala-lang.org/tour/pattern-matching.html#matching-on-case-classes).
Scala has a special type of class called a "case" class. By default, instances of case classes are immutable, and they are compared by value (unlike classes, whose instances are compared by reference). This makes them additionally useful for [pattern matching](https://docs.scala-lang.org/tour/pattern-matching.html#matching-on-case-classes).

You can define case classes with the `case class` keywords:

Expand All @@ -218,7 +218,7 @@ val anotherPoint = Point(1, 2)
val yetAnotherPoint = Point(2, 2)
```

Case classes are compared by value, not by reference:
Instances of case classes are compared by value, not by reference:

```tut
if (point == anotherPoint) {
Expand Down
2 changes: 1 addition & 1 deletion _tour/case-classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message1.sender = "travis@washington.us" // this line does not compile
You can't reassign `message1.sender` because it is a `val` (i.e. immutable). It is possible to use `var`s in case classes but this is discouraged.

## Comparison
Case classes are compared by structure and not by reference:
Instances of case classes are compared by structure and not by reference:
```tut
case class Message(sender: String, recipient: String, body: String)

Expand Down