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
Potentials (π) represent values that are possibly under initialization.
252
-
253
-
-`this`: current object
254
-
-`Warm(C, π)`: an object of type `C` where all its fields are assigned, and the potential for `this` of its enclosing class is `π`.
255
-
-`π.f`: the potential of the field `f` in the potential `π`
256
-
-`π.m`: the potential of the field `f` in the potential `π`
257
-
-`π.super[D]`: essentially the object π, used for virtual method resolution
258
-
-`Cold`: an object with unknown initialization status
259
-
-`Fun(Π, Φ)`: a function, when called produce effects Φ and return potentials Π.
260
-
-`π.outer[C]`: the potential of `this` for the enclosing class of `C` when `C.this` is `π`.
261
-
262
-
Effects are triggered from potentials:
263
-
264
-
-`π↑`: promote the object pointed to by the potential `π` to fully-initialized
265
-
-`π.f!`: access field `f` on the potential `π`
266
-
-`π.m!`: call the method `m` on the potential `π`
267
-
268
-
To ensure that the checking always terminate and for better
269
-
performance, we restrict the length of potentials to be finite (by
270
-
default 2). If the potential is too long, the checker stops
271
-
tracking it by checking that the potential is actually transitively
272
-
initialized.
273
-
274
-
For an expression `e`, it may be summarized by the pair `(Π, Φ)`,
275
-
which means evaluation of `e` may produce the effects Φ and return the
276
-
potentials Π. Each field and method is associated with such a pair.
277
-
We call such a pair _summary_. The expansion of proxy potentials and effects,
278
-
such as `π.f`, `π.m` and `π.m!`, will take advantage of the summaries.
279
-
Depending on the potential `π` for `this`, the summaries need to be rebased (`asSeenFrom`) before usage.
280
-
281
-
The checking treats the templates of concrete classes as entry points.
282
-
It maintains the set of initialized fields as initialization
283
-
progresses, and check that only initialized fields are accessed during
284
-
the initialization and there is no leaking of values under initialization.
285
-
Virtual method calls on `this` is not a problem,
286
-
as they can always be resolved statically.
220
+
Meanwhile, inheritance across project boundary has been under scrutiny and the
221
+
introduction of [open classes](./open-classes.html) mitigate the concern here.
222
+
For example, the initialization check could enforce that the constructors of
223
+
open classes may not contain method calls on `this` or introduce annotations as
224
+
a contract.
287
225
288
-
For a more detailed introduction of the theory, please refer to the paper _a type-and-effect system for safe initialization_[3].
226
+
The feedback from the community on the topic is welcome.
289
227
290
228
## Back Doors
291
229
@@ -302,5 +240,4 @@ mark some fields as lazy.
302
240
## References
303
241
304
242
1. Fähndrich, M. and Leino, K.R.M., 2003, July. [_Heap monotonic typestates_](https://www.microsoft.com/en-us/research/publication/heap-monotonic-typestate/). In International Workshop on Aliasing, Confinement and Ownership in object-oriented programming (IWACO).
305
-
2. Lucassen, J.M. and Gifford, D.K., 1988, January. [_Polymorphic effect systems_](https://dl.acm.org/doi/10.1145/73560.73564). In Proceedings of the 15th ACM SIGPLAN-SIGACT symposium on Principles of programming languages (pp. 47-57). ACM.
306
-
3. Fengyun Liu, Ondřej Lhoták, Aggelos Biboudis, Paolo G. Giarrusso, and Martin Odersky. 2020. [_A type-and-effect system for object initialization_](https://dl.acm.org/doi/10.1145/3428243). OOPSLA, 2020.
243
+
2. Fengyun Liu, Ondřej Lhoták, Aggelos Biboudis, Paolo G. Giarrusso, and Martin Odersky. 2020. [_A type-and-effect system for object initialization_](https://dl.acm.org/doi/10.1145/3428243). OOPSLA, 2020.
0 commit comments