Elsevier

Science of Computer Programming

Volume 80, Part B, 1 February 2014, Pages 311-342
Science of Computer Programming

Execution levels for aspect-oriented programming: Design, semantics, implementations and applications

https://doi.org/10.1016/j.scico.2013.09.002Get rights and content
Under an Elsevier user license
open archive

Highlights

  • We introduce execution levels in order to address the issue of infinite regression of aspect-oriented programs.

  • This issue is prevalent in existing AspectJ projects and a textbook code.

  • A formalization of execution levels shows that certain kinds of loops are indeed avoided.

  • Execution levels can be implemented using different techniques, possibly very efficiently.

Abstract

In aspect-oriented programming (AOP) languages, advice evaluation is usually considered as part of the base program evaluation. This is also the case for certain pointcuts, such as if pointcuts in AspectJ, or simply all pointcuts in higher-order aspect languages like AspectScheme. While viewing aspects as part of base level computation clearly distinguishes AOP from reflection, it also comes at a price: because aspects observe base level computation, evaluating pointcuts and advice at the base level can trigger infinite regression. To avoid these pitfalls, aspect languages propose ad-hoc mechanisms, which increase the complexity for programmers while being insufficient in many cases. After shedding light on the many facets of the issue, this paper proposes to clarify the situation by introducing levels of execution in the programming language, thereby allowing aspects to observe and run at specific, possibly different, levels. We adopt a defensive default that avoids infinite regression, and gives advanced programmers the means to override this default using level-shifting operators. We then study execution levels both in practice and in theory. First, we study the relevance of the issues addressed by execution levels in existing aspect-oriented programs. We then formalize the semantics of execution levels and prove that the default semantics is indeed free of a certain form of infinite regression, which we call aspect loops. Finally, we report on existing implementations of execution levels for aspect-oriented extensions of Scheme, JavaScript and Java, discussing their implementation techniques and current applications.

Keywords

Aspect-oriented programming
Meta-programming
Infinite regression
Execution levels

Cited by (0)

Earlier versions of the main matter of this article appeared in the informal proceedings of the Scheme and Functional Programming Workshop 2009 [48], and in the Proceedings of the 9th International Conference on Aspect-Oriented Software Development [49]. Additional content on exception handling appears in the Proceedings of the Foundations of Aspect Languages Workshop 2011 [24]. Accompanying material and notes are available online: http://pleiad.cl/research/scope/levels. Éric Tanter is partially funded by FONDECYT Project 1110051. Ismael Figueroa is funded by a CONICYT—Chile Doctoral Scholarship. This work was partially funded by the Inria Associate Teams RAPIDS and REAL.