Skip to content

Commit a228e47

Browse files
liufengyunolhotak
andauthored
Apply suggestions from code review
Co-authored-by: Ondřej Lhoták <olhotak@uwaterloo.ca>
1 parent c8b9bd4 commit a228e47

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ of warm objects.
215215
Two more abstractions are introduced to support functions and conditional
216216
expressions:
217217

218-
- __Fun(e, V, C)__: A abstract function value where `e` is the code, `V` is the
218+
- __Fun(e, V, C)__: An abstract function value where `e` is the code, `V` is the
219219
abstract value for `this` inside the function body and the function is located
220220
inside the class `C`.
221221

222222
- __Refset(Vs)__: A set of abstract values `Vs`.
223223

224224
## Rules
225225

226-
With the established principles and design goals, following rules are imposed:
226+
With the established principles and design goals, the following rules are imposed:
227227

228228
1. The field access `e.f` or method call `e.m()` is illegal if `e` is _cold_.
229229

@@ -234,14 +234,14 @@ With the established principles and design goals, following rules are imposed:
234234
3. In an assignment `o.x = e`, the expression `e` must be _effectively hot_.
235235

236236
This is how monotonicity is enforced in the system. Note that in an
237-
initialization `val f: T = e`, the expression `e` may point to an non-hot
237+
initialization `val f: T = e`, the expression `e` may point to a non-hot
238238
value.
239239

240240
4. Arguments to method calls must be _effectively hot_.
241241

242242
Escape of `this` in the constructor is commonly regarded as an anti-pattern.
243243

244-
However, escape of `this` as constructor arguments are allowed, to support
244+
However, escape of `this` as argument to another constructor is allowed, to support
245245
creation of cyclic data structures. The checker will ensure that the escaped
246246
non-initialized object is not used, i.e. calling methods or accessing fields
247247
on the escaped object is not allowed.
@@ -250,7 +250,7 @@ With the established principles and design goals, following rules are imposed:
250250
the method call `Some.apply(e)` will be interpreted as `new Some(e)`, thus
251251
is valid even if `e` is not hot.
252252

253-
Another exception too this rule is parametric method calls. For example, in
253+
Another exception to this rule is parametric method calls. For example, in
254254
`List.apply(e)`, the argument `e` may be non-hot. If that is the case, the
255255
result value of the parametric method call is taken as _cold_.
256256

@@ -277,18 +277,18 @@ With the established principles and design goals, following rules are imposed:
277277
The variable `Vargs` represents values of `args` with non-hot values widened
278278
to `Cold`.
279279

280-
The widening is motivated to finitize the abstract domain and ensure
281-
terimination of the initialization check.
280+
The motivation for the widening is to finitize the abstract domain and ensure
281+
termination of the initialization check.
282282

283-
9. The scrutinee in pattern match, the values in return and throw statements must be _effectively hot_.
283+
9. The scrutinee in a pattern match and the values in return and throw statements must be _effectively hot_.
284284

285285
A value `v` is _effectively hot_ if any of the following is true:
286286

287287
- `v` is `Hot`.
288-
- `v` is `ThisRef` and all fields of the underlying object are initialized.
288+
- `v` is `ThisRef` and all fields of the underlying object are assigned.
289289
- `v` is `Warm[C] { outer = V, ctor, args = Vs }` and
290290
1. `C` does not contain inner classes;
291-
2. Calling any method on `v` encounters no errors and the method return value is _effectively hot_;
291+
2. Calling any method on `v` encounters no initialization errors and the method return value is _effectively hot_;
292292
3. Each field of `v` is _effectively hot_.
293293
- `v` is `Fun(e, V, C)` and calling the function encounters no errors and the
294294
function return value is _effectively hot_.

0 commit comments

Comments
 (0)