Initializing Global Objects: Time and Order
Fengyun Liu, Ondrej Lhoták, David Hua, Enze Xing
Abstract
Object-oriented programming has been bothered by an awkward feature for a long time: static members. Static members not only compromise the conceptual integrity of object-oriented programming, but also give rise to subtle initialization errors, such as reading non-initialized fields and deadlocks.
The Scala programming language eliminated static members from the language, replacing them with global objects that present a unified object-oriented programming model. However, the problem of global object initialization remains open, and programmers still suffer from initialization errors.
We propose partial ordering and initialization-time irrelevance as two fundamental principles for initializing global objects. Based on these principles, we put forward an effective static analysis to ensure safe initialization of global objects, which eliminates initialization errors at compile time. The analysis also enables static scheduling of global object initialization to avoid runtime overhead. The analysis is modular at the granularity of objects and it avoids whole-program analysis. To make the analysis explainable and tunable, we introduce the concept of regions to make context-sensitivity understandable and customizable by programmers.
CCS Concepts: • Software and its engineering → Object oriented languages; Classes and objects.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers1
Ask how each one uses itBuilds on2
- A type-and-effect system for object initializationFengyun Liu, Ondrej Lhoták, Aggelos Biboudis, Paolo G. Giarrusso et al.OOPSLA 2020 · 8 citations
- A conceptual framework for safe object initialization: a principled and mechanized soundness proof of the Celsius modelClement Blaudeau, Fengyun LiuOOPSLA 2022 · 2 citations
Related papers
- ιDOT: a DOT calculus with object initializationIfaz Kabir, Yufeng Li, Ondrej LhotákOOPSLA 2020 · 3 citations
- A practical mode system for recursive definitionsAlban Reynaud, Gabriel Scherer, Jeremy YallopPOPL 2021 · 2 citations
- Modular Type Safety for Traits with Extensible Variants and Deep Pattern MatchingAndong Fan, Lionel Parreaux, Ningning XieOOPSLA 2026
- CiFi: Versatile Analysis of Class and Field ImmutabilityTobias Roth, Dominik Helm, Michael Reif, Mira MeziniASE 2021 · 7 citations
- Optimistic Stack Allocation and Dynamic Heapification for Managed RuntimesAditya Anand, Solai Adithya, Swapnil Rustagi, Priyam Seth et al.PLDI 2024 · 4 citations
