×

Featherweight Java with dynamic and static overloading. (English) Zbl 1183.68137

Summary: We propose FMJ (Featherweight Multi Java), an extension of Featherweight Java with encapsulated multi-methods thus providing dynamic overloading. Multi-methods (collections of overloaded methods associated to the same message, whose selection takes place dynamically instead of statically as in standard overloading) are a useful and flexible mechanism which enhances re-usability and separation of responsibilities. However, many mainstream languages, such as, e.g., Java, do not provide it, resorting to only static overloading.
The proposed extension is conservative and type safe: both “message-not-understood” and “message-ambiguous” are statically ruled out. Possible ambiguities are checked during type checking only on method invocation expressions, without requiring to inspect all the classes of a program. A static annotation with type information guarantees that in a well-typed program no ambiguity can arise at run-time. This annotation mechanism also permits modeling static overloading in a smooth way.
Our core language can be used as the formal basis for an actual implementation of dynamic (and static) overloading in Java-like languages.

MSC:

68N15 Theory of programming languages
PDFBibTeX XMLCite
Full Text: DOI

References:

[1] Abadi, M.; Cardelli, L.: A theory of objects, (1996) · Zbl 0876.68014
[2] Alexandrescu, A.: Modern C++ design, generic programming and design patterns applied, (2001)
[3] E. Allen, D. Chase, J. Hallett, V. Luchangco, J. Maessen, S. Ryu, G. Steele, S. Tobin-Hochstadt, The Fortress language specification Version 1.0, Sun Microsystems, available on line, 2006
[4] D. Ancona, S. Drossopoulou, E. Zucca, Overloading and Inheritance, FOOL 8, 2001
[5] André, P.; Royer, J. -C.: Optimizing method search with lookup caches and incremental coloring, , 110-126 (1992)
[6] , Implementing an object-oriented database system: the story of O2 (1992)
[7] Bettini, L.; Capecchi, S.; Venneri, B.: Translating double-dispatch into single-dispatch, Entcs 138 (2005) · Zbl 1272.68091
[8] Bettini, L.; Capecchi, S.; Venneri, B.: Double dispatch in C++, Software: practice and experience 36, No. 6, 581-613 (2006)
[9] Bettini, L.; Capecchi, S.; Venneri, B.: Featherweight Java with multi-methods, Proc. of PPPJ, principles and practice of programming in Java 272, 83-92 (2007) · Zbl 1183.68137
[10] Beugnard, A.: Method overloading and overriding cause encapsulation flaw: an experiment on assembly of heterogeneous components, , 1424-1428 (2006)
[11] Beyer, D.; Lewerentz, C.; Simon, F.: Impact of inheritance on metrics for size, coupling, and cohesion in object-oriented systems, , 1-17 (2000) · Zbl 0977.68820
[12] Bobrow, D.; Demichiel, L.; Gabriel, R.; Keene, S.; Kiczales, G.: Common lisp object system specification, Lisp and symbolic computation 1, No. 3/4, 245-394 (1989)
[13] Boyland, J.; Castagna, G.: Parasitic methods: implementation of multi-methods for Java, ACM SIGPLAN notices 32(10), 66-76 (1997)
[14] Bruce, K. B.; Cardelli, L.; Castagna, G.; Group, T. H. O.; Leavens, G.; Pierce, B. C.: On binary methods, Theory and practice of object systems 1, No. 3, 217-238 (1995)
[15] P. Carbonetto, An implementation for multiple dispatch in java using the elide framework
[16] Cardelli, L.; Wegner, P.: On understanding types, data abstraction, and polymorphism, ACM computing surveys 17, No. 4, 471-522 (1985)
[17] Castagna, G.: Covariance and contravariance: conflict without a cause, ACM transactions on programming languages and systems 17, No. 3, 431-447 (1995)
[18] Castagna, G.: A meta-language for typed object-oriented languages, Theoretical computer science 151, No. 2, 297-352 (1995) · Zbl 0871.68030 · doi:10.1016/0304-3975(95)00071-4
[19] Castagna, G.: Object-oriented programming: A unified foundation, (1997) · Zbl 0871.68024
[20] Chambers, C.; Leavens, G.: Typechecking and modules for multimethods, ACM transactions on programming languages and systems 17, No. 6, 805-843 (1995)
[21] C. Chambers, G. Leavens, BeCecil, A core object-oriented language with block structure and multimethods: Semantics and typing, in: The 4th Int. Workshop on Foundations of Object-Oriented Languages, FOOL 4, 1996
[22] Clifton, C.; Leavens, G.; Chambers, C.; Millstein, T.: Multijava: modular open classes and symmetric multiple dispatch for Java, ACM SIGPLAN notices 35, No. 10, 130-145 (2000)
[23] Demichiel, L.; Gabriel, R.: The common lisp object system: an overview, Lncs 276, 151-170 (1987)
[24] Driesen, K.; Hölzle, U.: Minimizing row displacement dispatch tables, , 141-155 (1995)
[25] C. Dutchyn, P. Lu, D. Szafron, S. Bromling, W. Holst, Multi-dispatch in the Java virtual machine: Design and implementation, in: Proc. of the 6th USENIX Conf. on Object-Oriented Technologies and Systems, COOTS ’01, 2001, pp. 77–92
[26] Forax, R.; Duris, E.; Roussel, G.: Java multi-method framework, (2000)
[27] Gamma, E.; Helm, R.; Johnson, R.; Vlissides, J.: Design patterns: elements of reusable object-oriented software, (1995) · Zbl 0887.68013
[28] Grothoff, C.: Walkabout revisited: the runabout, Lncs 2743 (2003)
[29] Igarashi, A.; Pierce, B.; Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ, ACM transactions on programming languages and systems 23, No. 3, 396-450 (2001)
[30] Ingalls, D.: A simple technique for handling multiple polymorphism, , 347-349 (1986)
[31] Keene, S.: Object-oriented programming in common lisp, (1989) · Zbl 0743.68118
[32] Kumar, R.; Agrawal, V.; Mangolia, A.: Realization of multimethods in single dispatch object oriented languages, SIGPLAN notes 40, No. 5, 18-27 (2005)
[33] Lea, D.: Run-time type information and class design, , 341-347 (1992)
[34] Leavens, G.; Millstein, T.: Multiple dispatch as dispatch on tuples, , 374-387 (1998)
[35] Lippman, S.: Inside the C++ object model, (1996)
[36] Meyer, B.: Eiffel: the language, (1991) · Zbl 0779.68013
[37] Meyer, B.: Overloading vs. Object technology, Journal of object-oriented programming, No. October/November, 3-7 (2001)
[38] Millstein, T. D.; Chambers, C.: Modular statically typed multimethods, Information and computation 175, No. 1, 76-118 (2002) · Zbl 1012.68043
[39] Mugridge, W.; Hamer, J.; Hosking, J.: Multi-methods in a statically-typed programming language, Lncs 512, 307-324 (1991)
[40] Pierce, B. C.: Types and programming languages, (2002) · Zbl 0995.68018
[41] Pirkelbauer, P.; Solodkyy, Y.; Stroustrup, B.: Open multi-methods for C++, , 123-134 (2007) · Zbl 1211.68054
[42] Schärli, N.; Ducasse, S.; Nierstrasz, O.; Black, A.: Traits: composable units of behavior, Lncs 2743, 248-274 (2003)
[43] Shalit, A.: The dylan reference manual: the definitive guide to the new object-oriented dynamic language, (1997) · Zbl 0900.68121
[44] J. Smith, Draft proposal for adding Multimethods to C++, Available at: http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1529.html
[45] Smith, J.: Cmm - C++ with multimethods, Association of C/C++ users journal (2001)
[46] Stroustrup, B.: The design and evolution of C++, (1994)
[47] Vitek, J.; Horspool, R. N.: Compact dispatch tables for dynamically typed object oriented languages, Lncs 1060, 309-325 (1996)
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. In some cases that data have been complemented/enhanced by data from zbMATH Open. This attempts to reflect the references listed in the original paper as accurately as possible without claiming completeness or a perfect matching.