In most mainstream object-oriented languages, the object initialization protocol is based on constructors, where different constructors of the same class are, in fact, overloaded variants of the same method. This approach has some disadvantages: it forces an exponential growth of the code with respect to the number of properties, it may cause duplication of code, and it may create unnecessary code dependencies. To the best of our knowledge, the literature lacks formal proposals that model non-trivial object initialization protocols. In this paper we present a calculus (called FJMIP), which is an extension of the Igarashi-Pierce-Wadler Featherweight Java and models a novel object initialization protocol. Our calculus is reasonably simple, but it offers two benefits: (i) it formalizes a modular way of initializing objects that does not suffer from the previous mentioned flaws, while still being an expressive object initialization protocol; (ii) as a by-product, it allowed us to intr...
Viviana Bono, Jaroslaw D. M. Kusmierek