Skip to main content

A Sound Type System for Layer Subtyping and Dynamically Activated First-Class Layers

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2015)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 9458))

Included in the following conference series:

  • 664 Accesses

Abstract

Key features of context-oriented programming (COP) are layers—modules to describe context-dependent behavioral variations of a software system—and their dynamic activation, which can modify the behavior of multiple objects that have already been instantiated. Typechecking programs written in a COP language is difficult because the activation of a layer can even change objects’ interfaces. We formalize a small COP language called \(\text {ContextFJ}_{{<:}}\) with its operational semantics and type system and show its soundness. The language features (1) dynamically activated first-class layers, (2) inheritance of layer definitions, and (3) layer subtyping.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Re-typechecking inherited methods under the new \(\mathchoice{\mathtt{{requires}}}{\mathtt{{requires}}}{\mathtt{{requires}}}{{\tiny \mathtt {requires}}}\) clause would be another way to relax this condition but this is against modular checking.

  2. 2.

    The previous type system for ContextFJ [11] deals with ensure, an activation mechanism with a semantics slightly different from with, and T-InvkA is simpler. Further discussions on making proceed and with typesafe can be found in [12].

References

  1. Appeltauer, M., Hirschfeld, R.: The JCop language specification: Version 1.0, April 2012. Number 59. Universitätsverlag Potsdam (2012)

    Google Scholar 

  2. Appeltauer, M., Hirschfeld, R., Lincke, J.: Declarative layer composition with the JCop programming language. J. Object Technol. 12 (2013)

    Google Scholar 

  3. Bettini, L., Capecchi, S., Damiani, F.: On flexible dynamic trait replacement for Java-like languages. Sci. Comput. Program. 78(7), 907–932 (2013)

    Article  MATH  Google Scholar 

  4. Bono, V., Patel, A., Shmatikov, V.: A core calculus of classes and mixins. In: Guerraoui, R. (ed.) ECOOP 1999. LNCS, vol. 1628, pp. 43–66. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  5. Chiba, S., Igarashi, A., Zakirov, S.: Mostly modular compilation of crosscutting concerns by contextual predicate dispatch. In: Proceedings of the ACM OOPSLA, pp. 539–554 (2010)

    Google Scholar 

  6. Clifton, C., Millstein, T., Leavens, G.T., Chambers, C.: MultiJava: design rationale, compiler implementation, and applications. ACM Trans. Prog. Lang. Syst. 28(3), 517–575 (2006)

    Article  Google Scholar 

  7. Drossopoulou, S., Damiani, F., Dezani-Ciancaglini, M., Giannini, P.: More dynamic object reclassification: Fickle\(_{\rm I\!I}\). ACM Trans. Prog. Lang. Syst. 24(2), 153–191 (2002)

    Article  Google Scholar 

  8. Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: Proceedings of the ACM POPL, pp. 171–183. ACM (1998)

    Google Scholar 

  9. Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. J. Object Technol. 7(3), 125–151 (2008)

    Article  Google Scholar 

  10. Hirschfeld, R., Igarashi, A., Masuhara, H.: ContextFJ: a minimal core calculus for context-oriented programming. In: Proceedings of Foundations of Aspect-Oriented Languages (FOAL), March 2011

    Google Scholar 

  11. Igarashi, A., Hirschfeld, R., Masuhara, H.: A type system for dynamic layer composition. In: Proceedings of FOOL, October 2012

    Google Scholar 

  12. Igarashi, A., Inoue, H., Hirschfeld, R., Masuhara, H.: ContextFJ: a minimal calculus for context-oriented programming (2015) (in preparation for submission)

    Google Scholar 

  13. Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)

    Article  Google Scholar 

  14. Inoue, H., Igarashi, A., Appeltauer, M., Hirschfeld, R.: Towards type-safe JCop: a type system for layer inheritance and first-class layers. In: Proceedings of the Workshop on Context-Oriented Programming, pp. 7:1–7:6. ACM (2014)

    Google Scholar 

  15. Kamina, T., Tamai, T.: McJava – a design and implementation of Java with mixin-types. In: Chin, W.-N. (ed.) APLAS 2004. LNCS, vol. 3302, pp. 398–414. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  16. Liquori, L., Spiwack, A.: FeatherTrait: a modest extension of Featherweight Java. ACM Trans. Prog. Lang. Syst. 30(2), 11 (2008)

    Article  Google Scholar 

  17. Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgments

We thank Tomoyuki Aotani, Malte Appeltauer, Robert Hirschfeld, and Tetsuo Kamina for valuable discussions on the subject. We appreciate valuable comments and suggestions from the anonymous reviewers. This work was supported in part by Kyoto University Design School (Inoue) and MEXT KAKENHI Grant Number 23220001 (Igarashi).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Hiroaki Inoue .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Inoue, H., Igarashi, A. (2015). A Sound Type System for Layer Subtyping and Dynamically Activated First-Class Layers. In: Feng, X., Park, S. (eds) Programming Languages and Systems. APLAS 2015. Lecture Notes in Computer Science(), vol 9458. Springer, Cham. https://doi.org/10.1007/978-3-319-26529-2_24

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-26529-2_24

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-26528-5

  • Online ISBN: 978-3-319-26529-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics