Skip to content

a bit more context for open feature #1938

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 2 commits into from
Mar 15, 2021
Merged
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
5 changes: 2 additions & 3 deletions _overviews/scala3-book/domain-modeling-oop.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ class SoftwareDeveloper(name: String, favoriteLang: String)
```
However, since _traits_ are designed as the primary means of decomposition,
a class that is defined in one file _cannot_ be extended in another file.
In order to allow this, the base class needs to be [marked as `open`][open]:
In order to allow this, the base class needs to be marked as `open`:
```scala
open class Person(name: String)
```
Having to explicitly mark classes as open avoids many common pitfalls in OO design.
Marking classes with [`open`](open) is a new feature of Sala 3. Having to explicitly mark classes as open avoids many common pitfalls in OO design.
In particular, it requires library designers to explicitly plan for extension and for instance document the classes that are marked as open with additional extension contracts.

{% comment %}
Expand Down Expand Up @@ -289,4 +289,3 @@ NOTE: One thing I occasionally do is flip things like this around, so I first sh