Tech Report CS-02-13

A Semantics for Pointcuts and Advice in Higher-Order Languages

David B. Tucker and Shriram Krishnamurthi

March 2003


Aspect-oriented programming has proven to be a useful model for developing software that encapsulates features in separate modules. AspectJ, one popular aspect-oriented language, extends Java with pointcuts and advice, which allow the programmer to modify the execution of existing code. However, formal semantics for pointcuts and advice only cover first-order procedural languages. We wish to port this model of aspect-oriented programming to higher-order languages in order to explore the synergy between the aspect-oriented and functional programming paradigms.

To this end, we define an operational semantics for pointcuts and advice in a Scheme-like language. Our formulation relies on two key ideas. First, we define aspects as first-class values, which integrates well with a functional language. Second, we allow an aspect to apply to a section of code either statically or dynamically. Our semantics reduce this distinction to the related notion of static and dynamic scope.

(complete text in pdf or gzipped postscript)