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.
Author supplied keywords
Cite
CITATION STYLE
Liu, F., Lhoták, O., Hua, D., & Xing, E. (2023). Initializing Global Objects: Time and Order. Proceedings of the ACM on Programming Languages, 7(OOPSLA2), 1310–1337. https://doi.org/10.1145/3622844
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.