Abstract:
Context-oriented programming (COP) enhances the modularity of context-dependent behavior in context-aware systems, as it provides modules to implement context- dependent behavior (layers) and composes them dynamically in a disciplined manner (layer activation). We propose a COP language that enables layers to define base methods, while the layers can be asynchronously activated and deactivated. Base methods in layers enhance modularity because they extend the interface of classes without modifying original class definitions. However, calling such a method defined in a layer is problematic as the layer may be inactive when the method is called. We address this problem by introducing a method lookup mechanism that uses the static scope of method invocation for COP; i.e., in addition to currently activated layers, the layer where the method invocation is written, as well as the layers on which that layer depends, are searched during method lookup. We formalize this mechanism as a small calculus referred to as ContextFJ a and prove its type soundness. We implement this mechanism in ServalCJ, a COP language that supports asynchronous, as well as synchronous, layer activation.
Reference:
Method Safety Mechanism for Asynchronous Layer Deactivation (Tetsuo Kamina, Tomoyuki Aotani, Hidehiko Masuhara and Atsushi Igarashi), In Science of Computer Programming, volume 156, 2018.
Bibtex Entry:
@article{kamina2018scp,
pdf = {scp2018.pdf},
author = {Tetsuo Kamina and Tomoyuki Aotani and Hidehiko Masuhara and Atsushi Igarashi},
title = {Method Safety Mechanism for Asynchronous Layer Deactivation},
keywords = {Context-Oriented Programming},
journal = {Science of Computer Programming},
year = 2018,
volume = 156,
date = {2018-05-01},
annote = {Received 17 February 2016, Revised 15 January 2018, Accepted 21 January 2018, Available online 20 February 2018.},
pages = {104--120},
doi = {https://doi.org/10.1016/j.scico.2018.01.006},
month = may,
url = {https://www.sciencedirect.com/science/article/pii/S0167642318300236},
abstract = {Context-oriented programming (COP) enhances the modularity of context-dependent behavior in context-aware systems, as it provides modules to implement context- dependent behavior (layers) and composes them dynamically in a disciplined manner (layer activation). We propose a COP language that enables layers to define base methods, while the layers can be asynchronously activated and deactivated. Base methods in layers enhance modularity because they extend the interface of classes without modifying original class definitions. However, calling such a method defined in a layer is problematic as the layer may be inactive when the method is called. We address this problem by introducing a method lookup mechanism that uses the static scope of method invocation for COP; i.e., in addition to currently activated layers, the layer where the method invocation is written, as well as the layers on which that layer depends, are searched during method lookup. We formalize this mechanism as a small calculus referred to as ContextFJ a and prove its type soundness. We implement this mechanism in ServalCJ, a COP language that supports asynchronous, as well as synchronous, layer activation.}
}