Abstract
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 introduce a novel technique to prove that our object initialization process actually initializes all the fields of an object.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Abadi, M., Cardelli, L.: A Theory of Objects. Springer, Heidelberg (1996)
Bono, V., Kuśmierek, J.: Featherweight JavaMIP: a calculus for a modular object initialization protocol. Manuscript (2007), available at http://www.di.unito.it/~bono/papers/FWJavaMIP.pdf
Bono, V., Kuśmierek, J.: Modularizing constructors. In: Proc. TOOLS 2007 (to appear, 2007)
Bruce, K.B.: Foundations of Object-Oriented Languages: Types and Semantics. MIT Press, Cambridge (2002)
Fisher, K., Honsell, F., Mitchell, J.C.: A lambda-calculus of objects and method specialization. Nordic J. of Computing, 1(1), 3–37 (1994). Preliminary version appeared In: Proc. LICS 1993, pp. 26–38 (1993)
Fisher, K., Mitchell, J.C.: A delegation-based object calculus with subtyping. In: Proc. FCT 1995, vol. 965, pp. 42–61. Springer, Heidelberg (1995)
Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and Mixins. In: Proc. POPL 1998, pp. 171–183. ACM Press, New York (1998)
Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM SIGPLAN Transactions on Programming Languages and Systems (TOPLAS), 23(3) (May 2001)
Kuśmierek, J., Bono, V.: A modular object initialization protocol. Manuscript (2006), available at http://www.di.unito.it/~bono/papers/JavaMIP02.pdf
Monteferrante, G.: javamip2java: A preprocessor for the JavaMIP language(2006), Available at http://www.di.unito.it/~bono/papers/javamip/
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Bono, V., Kuśmierek, J.D.M. (2007). FJMIP: A Calculus for a Modular Object Initialization. In: Csuhaj-Varjú, E., Ésik, Z. (eds) Fundamentals of Computation Theory. FCT 2007. Lecture Notes in Computer Science, vol 4639. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-74240-1_10
Download citation
DOI: https://doi.org/10.1007/978-3-540-74240-1_10
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-74239-5
Online ISBN: 978-3-540-74240-1
eBook Packages: Computer ScienceComputer Science (R0)