This research examines the use of modular monadic semantics to specify the semantics of aspect oriented languages. Aspect-oriented programming [5] is a paradigm where different facets of a system’s behavior are programmed independently. Aspect languages then provide a mechanism for “weaving” the different behavior into a complete program. A principal criticism of the paradigm is the difficulty in reasoning about the interaction of different aspects in a woven system. The aspect language is expressed in terms of the object language, eliminating the distinction between the aspect meta-language and the object language. There have been several formulations of semantic definitions of AOP constructs. Wand [15] gave an early dynamic semantics for AOP. Lammel provided an alternative semantics based on method-call interception and superimposition. Later work extended by separated static and dynamic aspect semantics, yielding significant efficiency gains [12, 14]. Modular monadic semantics [2, 11, 13] was first introduced as a method for independently specifying denotations for various language constructs. This work focused on specification of modular interpreters; follow-on work examined the usefulness of modular monadic semantics for building and proving correctness of compilers [10, 3]. While the early work focused on independent specification of language constructs, it still coupled the language constructs by requiring them to be members of the same abstract syntax data type. A solution to this problem models algebraic data types as least fixed-points of functors. Each language element is represented as a single functor. This model allows language elements to be specified completely independently as algebras over a functor [4, 1, 6, 7, 8, 4]. An interpretation is then simply the folding of the collection of algebras for the language. Our work builds on the idea of semantics as functors. In contrast to the work above, which defines an algebra as a simple function over a functor, we represent an algebra as an explicitly as a data type with function valued members [9]. Doing this allows us to dynamically update the algebras. The use of updatable algebras facilitate the treatment of the aspect weaving process formally as a metaprogramming activity. Traditional language constructs are specified as updatable algebras. Aspect language semantics are specified as transformations on those semantic algebras. By using modular monadic semantics with updatable algebras, we expect to realize several benefits. Composability allows experimentation with various AOP semantic definitions. Additionally, updatable algebras provide a clear separation between the aspect meta-language semantics and the object language semantics, simplifying reasoning about a composed system. Finally, monadic semantics provides a convenient mechanism for staging compilers, allowing the separation of the dynamic and static semantics of aspect languages.
[1]
Cristina V. Lopes,et al.
Aspect-oriented programming
,
1999,
ECOOP Workshops.
[2]
Paul Hudak,et al.
Monad transformers and modular interpreters
,
1995,
POPL '95.
[3]
Shriram Krishnamurthi,et al.
Pointcuts and advice in higher-order languages
,
2003,
AOSD '03.
[4]
David A. Espinosa.
Semantic Lego
,
1995
.
[5]
J. E. Labra Gayo,et al.
LPS: A Language Prototyping System Using Modular Monadic Semantics
,
2001,
LDTA@ETAPS.
[6]
Paul Hudak,et al.
Modular Denotational Semantics for Compiler Construction
,
1996,
ESOP.
[7]
Guy L. Steele,et al.
Building interpreters by composing monads
,
1994,
POPL '94.
[8]
Oege de Moor,et al.
Static analysis of aspects
,
2003,
AOSD '03.
[9]
Graham Hutton,et al.
Fold and unfold for program semantics
,
1998,
ICFP '98.
[10]
Cristina V. Lopes,et al.
Aspect-oriented programming
,
1999,
ECOOP Workshops.
[11]
Juan Manuel Cueva Lovelle,et al.
Reusable monadic semantics of logic programs with arithmetic predicates
,
2001,
APPIA-GULP-PRODE.
[12]
Mitchell Wand.
A Semantics for Advice and Dynamic Join Points in Aspect-Oriented Programming
,
2001,
SAIG.
[13]
Samuel N. Kamin,et al.
Metacomputation-Based Compiler Architecture
,
2000,
MPC.
[14]
Ralf Lämmel,et al.
Dealing with large bananas
,
2000
.