Type-Safe Layer-Introduced Base Functions with Imperative Layer Activation
Layer-introduced base methods, which are the methods with new signatures in a layer and are added to a class, give layers more freedom to organize definitions of context-dependent behavior. However, we need to be careful so as not to call a layer-introduced base method while the layers that provide the method are inactive. Type-based solutions would help to avoid such a problematic situation, but existing ones are limited to context-oriented programming (COP) languages that have dynamically-scoped (i.e., the “with“ based) layer activation. We propose a COP framework in Haskell that supports both imperative and dynamically-scoped layer activation mechanisms, as well as layer-introduced base functions. By representing a context as a stack of active layers in a type of a function in Haskell, type safety—including the guarantee of activation of a layer that provides a layer-introduced function—is checked by the Haskell’s type system. This paper shows how our framework encodes COP features in Haskell using a simple example.
Sun 5 JulDisplayed time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change
15:30 - 17:00
|Efficient Layered Method Execution in ContextAmber
|Type-Safe Layer-Introduced Base Functions with Imperative Layer Activation