8000 Highlight deprecation of early definitions for initialization order by ollyw · Pull Request #1755 · scala/docs.scala-lang · GitHub
[go: up one dir, main page]

Skip to content

Highlight deprecation of early definitions for initialization order #175 8000 5

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
Sep 1, 2020
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
2 changes: 2 additions & 0 deletions _overviews/FAQ/initialization-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ Note that using multiple lazy vals creates a new risk: cycles among lazy vals ca

Early definitions are a bit unwieldy, there are limitations as to what can appear and what can be referenced in an early definitions block, and they don't compose as well as lazy vals: but if a lazy val is undesirable, they present another option. They are specified in SLS 5.1.6.

Note that early definitions are deprecated in Scala 2.13; they will be replaced by trait parameters in Scala 3. So, early definitions are not recommended for use if future compatibility is a concern.

#### Use constant value definitions ####
abstract class A {
val x1: String
Expand Down
0