Connecting Object Constraints with Context-oriented Programming: Scoping Constraints with Layers and Activating Layers with Constraints

Abstract

Context-oriented Programming extends object-oriented languages with a mechanism to dynamically adapt behavior. Object Constraint Programming orthogonally extends object-oriented run-times by integrating constraints, including support for constraints over mutable state, object identity, and the results of message sends. Using these two language extensions in conjunctions offers interesting opportunities. In this paper, we report on new mechanisms involving layers and constraints that evolved from our experiences with combining Babelsberg/JS, an Object Constraint Language, and ContextJS, an implementation of Context-oriented Programming in JavaScript. First, our experience shows that it is desirable to dynamically adapt declarative constraints, which offer an orthogonal mechanism to the definition of imperative behavior, likewise at runtime. In this work, we show an extension to ContextJS to scope activation or refinement of constraints dynamically using layers. Second, ContextJS already provides different activation mechanisms for layers, including dynamically or structurally scoped, or globally through system generated events. Constraints provide an activation mechanism based on arbitrary boolean expressions changing their value, allowing for interesting applications of behavioral adaption based on certain conditions.

DOI: 10.1145/2786545.2786549

Extracted Key Phrases

2 Figures and Tables

Cite this paper

@inproceedings{Lehmann2015ConnectingOC, title={Connecting Object Constraints with Context-oriented Programming: Scoping Constraints with Layers and Activating Layers with Constraints}, author={Stefan Lehmann and Tim Felgentreff and Robert Hirschfeld}, booktitle={COP@ECOOP}, year={2015} }