You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_docs/reference/other-new-features/safe-initialization.md
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -179,8 +179,8 @@ For example, if the arguments to an `new`-expression are transitively
179
179
initialized, so is the result. If the receiver and arguments in a method call
180
180
are transitively initialized, so is the result.
181
181
182
-
Local reasoning about initialization is the key to give rise to a fast
183
-
initialization checker, as it avoids whole-program analysis.
182
+
Local reasoning about initialization gives rise to a fast initialization
183
+
checker, as it avoids whole-program analysis.
184
184
185
185
The principle of authority goes hand-in-hand with monotonicity: the principle
186
186
of monotonicity stipulates that initialization states cannot go backwards, while
@@ -254,20 +254,21 @@ With the established principles and design goals, following rules are imposed:
254
254
`List.apply(e)`, the argument `e` may be non-hot. If that is the case, the
255
255
result value of the parametric method call is taken as _cold_.
256
256
257
-
5. Method calls on hot values with effectively hot arguments product hot results.
257
+
5. Method calls on hot values with effectively hot arguments produce hot results.
258
258
259
259
This rule is assured by local reasoning about initialization.
260
260
261
261
6. Method calls on `ThisRef` and warm values will be resolved statically and the
262
-
method bodies will be checked.
262
+
corresponding method bodies are checked.
263
263
264
264
7. In a new expression `new p.C(args)`, if the values of `p` and `args` are
265
265
effectively hot, then the result value is also hot.
266
266
267
267
This is assured by local reasoning about initialization.
268
268
269
269
8. In a new expression `new p.C(args)`, if any value of `p` and `args` is not
270
-
effectively hot, then the result value takes the form `Warm[C] { outer = Vp, args = Vargs }`.
270
+
effectively hot, then the result value takes the form `Warm[C] { outer = Vp, args = Vargs }`. The initialization code for the class `C` is checked again to make
271
+
sure the non-hot values are used properly.
271
272
272
273
In the above, `Vp` is the widened value of `p` --- the widening happens if `p`
273
274
is a warm value `Warm[D] { outer = V, args }` and we widen it to
0 commit comments