Abstract
We propose a Java-like language where class definitions are first class values and new classes can be derived from existing ones by exploiting the full power of the language itself, used on top of a small set of primitive composition operators, instead of using a fixed mechanism like inheritance.
Hence, compilation requires to perform (meta-)reduction steps, by a process that we call compile-time execution. This approach differs from meta-programming techniques available in mainstream languages since it is meta-circular, hence programmers are not required to learn new syntax and idioms.
Compile-time execution is guaranteed to be sound (not to get stuck) by a lightweight technique, where class composition errors are detected dynamically, and conventional typing errors are detected by interleaving typechecking with meta-reduction steps. This allows for a modular approach, that is, compile-time execution is defined, and can be implemented, on top of typechecking and execution of the underlying language. Moreover, programmers can handle errors due to composition operators.
Besides soundness, our technique ensures an additional important property called meta-level soundness, that is, typing errors never originate from (meta-)code in already compiled programs.
- }}Jonathan Aldrich, Craig Chambers, and David Notkin. Architectural reasoning in ArchJava. In Boris Magnusson, editor, ECOOP'02 - Object-Oriented Programming, number 2374 in Lecture Notes in Computer Science, pages 334--367. Springer, 2002. Google Scholar
Digital Library
- }}Davide Ancona, Ferruccio Damiani, Sophia Drossopoulou, and Elena Zucca. Polymorphic bytecode: Compositional compilation for Java-like languages. In ACM Symp. on Principles of Programming Languages 2005. ACM Press, January 2005. Google Scholar
Digital Library
- }}Davide Ancona, Giovanni Lagorio, and Elena Zucca. Jam--designing a Java extension with mixins. ACM Transactions on Programming Languages and Systems, 25(5):641--712, September 2003. Google Scholar
Digital Library
- }}Davide Ancona, Giovanni Lagorio, and Elena Zucca. Flexible type-safe linking of components for Java-like languages. In JMLC'06 - Joint Modular Languages Conference, volume 4228 of Lecture Notes in Computer Science, pages 136--154. Springer, 2006. Google Scholar
Digital Library
- }}Alexandre Bergel, Stéphane Ducasse, Oscar Nierstrasz, and Roel Wuyts. Stateful traits and their formalization. Comput. Lang. Syst. Struct., 34(2-3):83--108, 2008. Google Scholar
Digital Library
- }}Viviana Bono, Ferruccio Damiani, and Elena Giachino. On traits and types in a Java-like setting. In TCS'08 - IFIP Int. Conf. on Theoretical Computer Science. Springer, 2008.Google Scholar
Cross Ref
- }}Gilad Bracha. The Programming Language JIGSAW: Mixins, Modularity and Multiple Inheritance. PhD thesis, Department of Comp. Sci., Univ. of Utah, 1992. Google Scholar
Digital Library
- }}Krzysztof Czarnecki, Ulrich Eisenecker, Robert Gluck, David Vandevoorde, and Todd Veldhuizen. Generative programming and active libraries (extended abstract), pages 25--39. Number 1766 in Lecture Notes in Computer Science. Springer, 2000. Google Scholar
Digital Library
- }}Digital Mars. D programming language, 2007. http://www.digitalmars.com/.Google Scholar
- }}Stéphane Ducasse, Oscar Nierstrasz, Nathanael Schärli, Roel Wuyts, and Andrew Black. Traits: A mechanism for fine-grained reuse. ACM Transactions on Programming Languages and Systems, 28(2):331--388, 2006. Google Scholar
Digital Library
- }}Erik Ernst. Family polymorphism. In J.L. Knudsen, editor, ECOOP'01 - European Conference on Object-Oriented Programming, number 2072 in Lecture Notes in Computer Science, pages 303--326. Springer, 2001. Google Scholar
Digital Library
- }}Erik Ernst. Higher-order hierarchies. In L. Cardelli, editor, ECOOP'03 - Object-Oriented Programming, number 2743 in Lecture Notes in Computer Science, pages 303--328. Springer, 2003.Google Scholar
- }}Robert Bruce Findler and Matthew Flatt. Modular objectoriented programming with units and mixins. In Intl. Conf. on Functional Programming 1998, 1998. Google Scholar
Digital Library
- }}Kathleen Fisher and John Reppy. A typed calculus of traits. In FOOL'04 - Intl. Workshop on Foundations of Object-Oriented Languages, 2004.Google Scholar
- }}Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. Classes and mixins. In ACM Symp. on Principles of Programming Languages 1998, pages 171--183. ACM Press, 1998. Google Scholar
Digital Library
- }}Shan Shan Huang, David Zook, and Yannis Smaragdakis. Morphing: Safely shaping a class in the image of others. In ECOOP'07 - Object-Oriented Programming, pages 399--424. Springer, August 2007. Google Scholar
Digital Library
- }}Atsushi Igarashi, Benjamin C. Pierce, and Philip Wadler. Featherweight Java: A minimal core calculus for Java and GJ. In ACM Symp. on Object-Oriented Programming: Systems, Languages and Applications 1999, pages 132--146. ACM Press, 1999. Google Scholar
Digital Library
- }}International Organization for Standardization. ISO/IEC 14882:2003: Programming languages -- C++. International Organization for Standardization, 2003.Google Scholar
- }}Giovanni Lagorio, Marco Servetto, and Elena Zucca. Customizable composition operators for Java-like classes (extended abstract). In ICTCS'09 - Italian Conf. on Theoretical Computer Science, 2009.Google Scholar
- }}Giovanni Lagorio, Marco Servetto, and Elena Zucca. Featherweight Jigsaw - a minimal core calculus for modular composition of classes. In Sophia Drossopoulou, editor, ECOOP 2009 - Object-Oriented Programming, number 5653 in Lecture Notes in Computer Science. Springer, 2009. Google Scholar
Digital Library
- }}Giovanni Lagorio, Marco Servetto, and Elena Zucca. Flattening versus direct semantics for Featherweight Jigsaw. In FOOL'09 - Intl. Workshop on Foundations of Object-Oriented Languages, 2009.Google Scholar
- }}Giovanni Lagorio, Marco Servetto, and Elena Zucca. A lightweight approach to customizable composition operators for Java-like classes. Electronic Notes in Theoretical Computer Science, 263:161--177, 2010. FACS'09 - International Workshop on Formal Aspects of Component Software. Google Scholar
Digital Library
- }}Luigi Liquori and Arnaud Spiwack. FeatherTrait: A modest extension of Featherweight Java. ACM Transactions on Programming Languages and Systems, 30(2), 2008. Google Scholar
Digital Library
- }}Sean McDirmid, Matthew Flatt, and Wilson C. Hsieh. Jiazzi: New age components for old fashioned Java. In ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA 2001). ACM Press, 2001. SIGPLAN Notices. Google Scholar
Digital Library
- }}N. Nystrom, V. A. Saraswat, J. Palsberg, and C. Grothoff. Constrained types for object-oriented languages. In OOPSLA 2008, pages 457--474, 2008. Google Scholar
Digital Library
- }}John Reppy and Aaron Turon. Metaprogramming with traits. In Erik Ernst, editor, ECOOP'07 - Object-Oriented Programming, number 4609 in Lecture Notes in Computer Science, pages 373--398. Springer, 2007. Google Scholar
Digital Library
- }}Nathanael Schärli, Stéphane Ducasse, Oscar Nierstrasz, and Andrew P. Black. Traits: Composable units of behaviour. In ECOOP'03 - Object-Oriented Programming, volume 2743 of Lecture Notes in Computer Science, pages 248--274. Springer, 2003.Google Scholar
- }}Leon Shapiro and Ehud Y. Sterling. The Art of PROLOG: Advanced Programming Techniques. The MIT Press, April 1994. Google Scholar
Digital Library
- }}Tim Sheard. Accomplishments and research challenges in meta-programming. In 2nd Int. Workshop on Semantics, Applications, and Implementation of Program Generation, volume 2196 of Lecture Notes in Computer Science, pages 2--44. Springer, 2000. Google Scholar
Digital Library
- }}Walid Taha and Tim Sheard. MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science, 248(1-2):211--242, 2000. Google Scholar
Digital Library
- }}Michiaki Tatsubori, Shigeru Chiba, Marc-Olivier Kilijian, and Kozo Itano. OpenJava: A class-based macro system for Java. In Walter Cazzola, Robert J. Stroud, and Francesco Tisato, editors, Reflection and Software Engineering, Lecture Notes in Computer Science, pages 117--133. Springer, 2000. Google Scholar
Digital Library
- }}Edwin Westbrook, Mathias Ricken, Jun Inoue, Yilong Yao, Tamer Abdelatif, and Walid Taha. Mint: Java multistage programming using weak separability. In PLDI'10 - ACM Conf. on Programming Language Design and Implementation. ACM Press, 2010. Google Scholar
Digital Library
Index Terms
MetaFJig: a meta-circular composition language for Java-like classes
Recommendations
MetaFJig: a meta-circular composition language for Java-like classes
OOPSLA '10: Proceedings of the ACM international conference on Object oriented programming systems languages and applicationsWe propose a Java-like language where class definitions are first class values and new classes can be derived from existing ones by exploiting the full power of the language itself, used on top of a small set of primitive composition operators, instead ...
Modular language implementation in Rascal - experience report
All software evolves, and programming languages and programming language tools are no exception. And just like in ordinary software construction, modular implementations can help ease the process of changing a language implementation and its dependent ...
A meta-circular language for active libraries
We present a new Java-like language design coupling disciplined meta-programming features with a composition language. That is, programmers can write meta-expressions that combine class definitions, on top of a small set of composition operators, ...







Comments