A monadic interpretation of execution levels and exceptions for AOP

Aspect-Oriented Programming (AOP) started fifteen years ago with the remark that modularization of so-called crosscutting functionalities is a fundamental problem for the engineering of large-scale applications. Originating at Xerox PARC, this observation has sparked the development of a new style of programming features that is gradually gaining traction. However, theoretical foundations of AOP have been much less studied than its applicability. This paper proposes to put a bridge between AOP and the notion of 2-category to enhance the conceptual understanding of AOP. Starting from the connection between the λ-calculus and the theory of categories, we provide an internal language for 2-categories and show how it can be used to define the first categorical semantics for a realistic functional AOP language, called MinAML. We then take advantage of this new categorical framework to introduce the notion of computational 2-monads for AOP. We illustrate their conceptual power by defining a 2-monad for Éric Tanter's execution levels---which constitutes the first algebraic semantics for execution levels---and then introducing the first exception monad transformer specific to AOP that gives rise to a non-flat semantics for exceptions by taking levels into account.

[1]  S. Kovalyov Modeling Aspects by Category Theory , 2010 .

[2]  J. Lambek,et al.  Introduction to higher order categorical logic , 1986 .

[3]  Gregor Kiczales,et al.  A semantics for advice and dynamic join points in aspect-oriented programming , 2001, TOPL.

[4]  G. M. Kelly,et al.  Two-dimensional monad theory , 1989 .

[5]  G. M. Kelly,et al.  BASIC CONCEPTS OF ENRICHED CATEGORY THEORY , 2022, Elements of ∞-Category Theory.

[6]  Éric Tanter,et al.  A semantics for execution levels with exceptions , 2011, FOAL.

[7]  R. Street,et al.  Review of the elements of 2-categories , 1974 .

[8]  Roberto Erick Lopez-Herrejon,et al.  A disciplined approach to aspect composition , 2006, PEPM '06.

[9]  Éric Tanter Execution levels for aspect-oriented programming , 2010, AOSD.

[10]  Cristina V. Lopes,et al.  Aspect-oriented programming , 1999, ECOOP Workshops.

[11]  Tom Hirschowitz,et al.  Cartesian closed 2-categories and permutation equivalence in higher-order rewriting , 2013, Log. Methods Comput. Sci..

[12]  H. Bruggink,et al.  Equivalence of Reductions in Higher-Order Rewriting , 2008 .

[13]  Nicolas Tabareau,et al.  A practical monadic aspect weaver , 2012, FOAL '12.

[14]  Gregor Kiczales,et al.  Aspect-oriented programming , 2001, ESEC/FSE-9.

[15]  Nicolas Tabareau,et al.  Aspect oriented programming: a language for 2-categories , 2011, FOAL.

[16]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[17]  Bruno C. d. S. Oliveira,et al.  EffectiveAdvice: disciplined advice with explicit effects , 2010, AOSD.

[18]  Joachim Lambek,et al.  Cartesian Closed Categories and Typed Lambda- calculi , 1985, Combinators and Functional Programming Languages.

[19]  David Walker,et al.  A theory of aspects , 2003, ICFP '03.

[20]  Radha Jagadeesan,et al.  A Calculus of Untyped Aspect-Oriented Programs , 2003, ECOOP.

[21]  Bruno De Fraine,et al.  Essential AOP: The a calculus , 2010, TOPL.

[22]  R. A. G. Seely Modelling Computations: A 2-Categorical Framework , 1987, LICS.

[23]  B. Hilken,et al.  Towards a proof theory of rewriting: the simply typed 2l-calculus , 1996 .

[24]  Ralf Lämmel Adding superimposition to a language semantics , 2003 .

[25]  Wolfgang De Meuter Monads as a theoretical foundation for AOP , 2000 .

[26]  João Saraiva,et al.  The Objects and Arrows of Computational Design , 2008, MoDELS.

[27]  David Walker,et al.  Harmless advice , 2006, POPL '06.