Abstract
Context-Oriented programming languages provide us with primitive constructs to adapt programs behaviour depending on the evolution of their operational environment. In this paradigm developers must provide behaviour for any context a program may find in. A missing behaviour causes a new kind of runtime error: an adaptation error. We propose a novel mechanism, based on implicit function, that allows the execution environment to supply such behaviour when the program is not able to adapt. We assess our proposal extending a core functional language designed for adaptivity. We integrate the mechanism in a type and effect system, in the form of implicit coercions, showing that our type discipline guarantees that no adaptation errors occur.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Aotani, T., Kamina, T., Masuhara, H.: Featherweight EventCJ: a core calculus for a context-oriented language with event-based per-instance layer transition. In: Proceedings of the 3rd International Workshop on Context-Oriented Programming, pp. 1:1–1:7. ACM (2011)
Aotani, T., Kamina, T., Masuhara, H.: Unifying multiple layer activation mechanisms using one event sequence. In: Proceedings of 6th International Workshop on Context-Oriented Programming. ACM, NY (2014)
Appeltauer, M., Hirschfeld, R., Haupt, M., Lincke, J., Perscheid, M.: A comparison of context-oriented programming languages. In: International Workshop on Context-Oriented Programming. ACM, NY (2009)
Barthe, G.: Implicit coercions in type systems. In: Coppo, M., Berardi, S. (eds.) TYPES 1995. LNCS, vol. 1158, pp. 1–15. Springer, Heidelberg (1996)
Bartoletti, M., Degano, P., Ferrari, G.L.: Planning and verifying service composition. J. Comput. Secur. 17(5), 799–837 (2009)
Bartoletti, M., Degano, P., Ferrari, G.L., Zunino, R.: Local policies for resource usage analysis. ACM Trans. Program. Lang. Syst. 31(6), 1–43 (2009)
Bodei, C., Degano, P., Galletta, L., Salvatori, F.: Linguistic mechanisms for context-aware security. In: Ciobanu, G., Méry, D. (eds.) ICTAC 2014. LNCS, vol. 8687, pp. 61–79. Springer, Heidelberg (2014)
Bruni, R., Corradini, A., Gadducci, F., Lluch Lafuente, A., Vandin, A.: A conceptual framework for adaptation. In: de Lara, J., Zisman, A. (eds.) Fundamental Approaches to Software Engineering. LNCS, vol. 7212, pp. 240–254. Springer, Heidelberg (2012)
Cheng, B.H.C., et al.: Software engineering for self-adaptive systems: a research roadmap. In: Cheng, B.H.C., de Lemos, R., Giese, H., Inverardi, P., Magee, J. (eds.) Software Engineering for Self-Adaptive Systems. LNCS, vol. 5525, pp. 1–26. Springer, Heidelberg (2009)
Clarke, D., Costanza, P., Tanter, E.: How should context-escaping closures proceed? In: International Workshop on Context-Oriented Programming. ACM (2009)
Clarke, D., Sergey, I.: A semantics for context-oriented programming with layers. In: International Workshop on Context-Oriented Programming. ACM, NY (2009)
Degano, P., Ferrari, G.-L., Galletta, L.: A two-phase static analysis for reliable adaptation. In: Giannakopoulou, D., Salaün, G. (eds.) SEFM 2014. LNCS, vol. 8702, pp. 347–362. Springer, Heidelberg (2014)
Degano, P., Ferrari, G.L., Galletta, L.: A two-component language for COP. In: 6th International Workshop on Context-Oriented Programming (2014)
Degano, P., Ferrari, G.-L., Galletta, L., Mezzetti, G.: Types for coordinating secure behavioural variations. In: Sirjani, M. (ed.) COORDINATION 2012. LNCS, vol. 7274, pp. 261–276. Springer, Heidelberg (2012)
Degano, P., Ferrari, G.L., Galletta, L., Mezzetti, G.: Typing context-dependent behavioural variation. In: Gay, S.J., Kelly, P. (eds.) Proceedings of Fifth Workshop on Programming Language Approaches to Concurrency- and Communication-cEntric Software, PLACES 2012. EPTCS, vol. 109, pp. 28–33 (2012)
Hirschfeld, R., Igarashi, A., Masuhara, H.: ContextFJ: a minimal core calculus for context-oriented programming. In: Proceedings of the 10th International Workshop on Foundations of Aspect-Oriented Languages, pp. 19–23. ACM (2011)
Hirschfeld, R., Costanza, P., Nierstrasz, O.: Context-oriented programming. J. Object Technol. 7(3), 125–151 (2008). March–April 2008, ETH Zurich
Igarashi, A., Hirschfeld, R., Masuhara, H.: A type system for dynamic layer composition. In: FOOL 2012, p. 13 (2012)
Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst. 23(3), 396–450 (2001)
Inoue, H., Igarashi, A., Appeltauer, M., Hirschfeld, R.: Towards type-safe JCop: a type system for layer inheritance and first-class layers. In: International Workshop on Context-Oriented Programming. ACM (2014)
Kamina, T., Aotani, T., Igarashi, A.: On-demand layer activation for type-safe deactivation. In: Proceedings of 6th International Workshop on Context-Oriented Programming, pp. 4:1–4:7. ACM (2014)
Kamina, T., Aotani, T., Masuhara, H.: A core calculus of composite layers. In: Proceedings of the 12th Workshop on Foundations of Aspect-Oriented Languages, pp. 7–12. ACM (2013)
Oliveira, B., Moors, A., Odersky, M.: Type classes as objects and implicits. In: Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA 2010, pp. 341–360. ACM (2010)
Oliveira, B., Schrijvers, T., Choi, W., Lee, W., Yi, K.: The implicit calculus: a new foundation for generic programming. In: ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2012, pp. 35–44 (2012)
Salehie, M., Tahvildari, L.: Self-adaptive software: landscape and research challenges. TAAS 4(2), 1–42 (2009)
Salvaneschi, G., Ghezzi, C., Pradella, M.: Context-oriented programming: a programming paradigm for autonomic systems. CoRR abs/1105.0069 (2011)
Salvaneschi, G., Ghezzi, C., Pradella, M.: An analysis of language-level support for self-adaptive software. ACM Trans. Auton. Adapt. Syst. 8(2), 7:1–7:29 (2013)
Skalka, C., Smith, S., Horn, D.V.: Types and trace effects of higher order programs. J. Funct. Program. 18(2), 179–249 (2008)
Swamy, N., Hicks, M.W., Bierman, G.M.: A theory of typed coercions and its applications. In: Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, ICFP 2009, Edinburgh, Scotland, UK, 2 August 31–September 2009, pp. 329–340 (2009)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2015 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Basile, D., Galletta, L., Mezzetti, G. (2015). Safe Adaptation Through Implicit Effect Coercion. In: Bodei, C., Ferrari, G., Priami, C. (eds) Programming Languages with Applications to Biology and Security. Lecture Notes in Computer Science(), vol 9465. Springer, Cham. https://doi.org/10.1007/978-3-319-25527-9_10
Download citation
DOI: https://doi.org/10.1007/978-3-319-25527-9_10
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-25526-2
Online ISBN: 978-3-319-25527-9
eBook Packages: Computer ScienceComputer Science (R0)