Skip to content

Commit 4eb2f89

Browse files
committed
Doc tweaks
1 parent 68543ff commit 4eb2f89

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/docs/reference/other-new-features/safe-initialization.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ The checker reports:
9393

9494
We establish the following design goals:
9595

96-
- __Safe__: checking always terminates, and is sound for common and reasonable usage (over-approximation)
97-
- __Fast__: instant feedback
96+
- __Sound__: checking always terminates, and is sound for common and reasonable usage (over-approximation)
9897
- __Expressive__: support common and reasonable initialization patterns
9998
- __Friendly__: simple rules, minimal syntactic overhead, informative error messages
10099
- __Modular__: modular checking, no analysis beyond project boundary
100+
- __Fast__: instant feedback
101101
- __Simple__: no changes to core type system, explainable by a simple theory
102102

103103
By _reasonable usage_, we include the following use cases (but not restricted to them):
@@ -154,15 +154,16 @@ With the established principles and design goals, following rules are imposed:
154154
This is how monotonicity is enforced in the system. Note that in an
155155
initialization `val f: T = e`, the expression `e` may point to an object
156156
under initialization. This requires a distinction between mutation and
157-
initialization in syntax in order to enforce different rules. The Scala
158-
syntax makes it easy to distinguish initialization from mutation.
157+
initialization in order to enforce different rules. Scala
158+
has different syntax for them, it thus is not an issue.
159159

160160
2. References to objects under initialization may not be passed as arguments to method calls or constructors.
161161

162162
Escape of `this` in the constructor is commonly regarded as an
163163
anti-pattern, and it's rarely used in practice. This rule is simple
164164
for the programmer to reason about initialization and it simplifies
165-
implementation.
165+
implementation. The theory supports safe escape of `this` with the help of
166+
annotations, we delay the extension until there is a strong need.
166167

167168
3. Local definitions may only refer to transitively initialized objects.
168169

0 commit comments

Comments
 (0)