skip to main content
research-article

MetaFJig: a meta-circular composition language for Java-like classes

Published:17 October 2010Publication History
Skip Abstract Section

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.

References

  1. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}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 ScholarGoogle ScholarCross RefCross Ref
  7. }}Gilad Bracha. The Programming Language JIGSAW: Mixins, Modularity and Multiple Inheritance. PhD thesis, Department of Comp. Sci., Univ. of Utah, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}Digital Mars. D programming language, 2007. http://www.digitalmars.com/.Google ScholarGoogle Scholar
  10. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. }}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 ScholarGoogle Scholar
  13. }}Robert Bruce Findler and Matthew Flatt. Modular objectoriented programming with units and mixins. In Intl. Conf. on Functional Programming 1998, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}Kathleen Fisher and John Reppy. A typed calculus of traits. In FOOL'04 - Intl. Workshop on Foundations of Object-Oriented Languages, 2004.Google ScholarGoogle Scholar
  15. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. }}International Organization for Standardization. ISO/IEC 14882:2003: Programming languages -- C++. International Organization for Standardization, 2003.Google ScholarGoogle Scholar
  19. }}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 ScholarGoogle Scholar
  20. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. }}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 ScholarGoogle Scholar
  22. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. }}Luigi Liquori and Arnaud Spiwack. FeatherTrait: A modest extension of Featherweight Java. ACM Transactions on Programming Languages and Systems, 30(2), 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  25. }}N. Nystrom, V. A. Saraswat, J. Palsberg, and C. Grothoff. Constrained types for object-oriented languages. In OOPSLA 2008, pages 457--474, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. }}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 ScholarGoogle Scholar
  28. }}Leon Shapiro and Ehud Y. Sterling. The Art of PROLOG: Advanced Programming Techniques. The MIT Press, April 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. }}Walid Taha and Tim Sheard. MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science, 248(1-2):211--242, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. }}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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. }}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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. MetaFJig: a meta-circular composition language for Java-like classes

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 45, Issue 10
      OOPSLA '10
      October 2010
      957 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1932682
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA '10: Proceedings of the ACM international conference on Object oriented programming systems languages and applications
        October 2010
        984 pages
        ISBN:9781450302036
        DOI:10.1145/1869459

      Copyright © 2010 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 17 October 2010

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!