Asian Symposium on Programming Languages and Systems

Programming Languages and Systems pp 445-462 | Cite as

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

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9458)

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.

Notes

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).

References

  1. 1.
    Appeltauer, M., Hirschfeld, R.: The JCop language specification: Version 1.0, April 2012. Number 59. Universitätsverlag Potsdam (2012)Google Scholar
  2. 2.
    Appeltauer, M., Hirschfeld, R., Lincke, J.: Declarative layer composition with the JCop programming language. J. Object Technol. 12 (2013)Google Scholar
  3. 3.
    Bettini, L., Capecchi, S., Damiani, F.: On flexible dynamic trait replacement for Java-like languages. Sci. Comput. Program. 78(7), 907–932 (2013)CrossRefMATHGoogle Scholar
  4. 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) CrossRefGoogle Scholar
  5. 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. 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)CrossRefGoogle Scholar
  7. 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)CrossRefGoogle Scholar
  8. 8.
    Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: Proceedings of the ACM POPL, pp. 171–183. ACM (1998)Google Scholar
  9. 9.
    Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. J. Object Technol. 7(3), 125–151 (2008)CrossRefGoogle Scholar
  10. 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 2011Google Scholar
  11. 11.
    Igarashi, A., Hirschfeld, R., Masuhara, H.: A type system for dynamic layer composition. In: Proceedings of FOOL, October 2012Google Scholar
  12. 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. 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)CrossRefGoogle Scholar
  14. 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. 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) CrossRefGoogle Scholar
  16. 16.
    Liquori, L., Spiwack, A.: FeatherTrait: a modest extension of Featherweight Java. ACM Trans. Prog. Lang. Syst. 30(2), 11 (2008)CrossRefGoogle Scholar
  17. 17.
    Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994)CrossRefMathSciNetMATHGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  1. 1.Graduate School of InformaticsKyoto UniversityKyotoJapan

Personalised recommendations