Aspects for Stages: Cross Cutting Concerns for Metaprograms

By: Yannis Lilis, Anthony Savidis


In multi-stage languages the program code is finalized though a sequence of transformations defined in the program itself, a process known as staging, with stages also referred as metaprograms. Since stages are essentially programs, they may also require application of aspect-oriented methods to handle crosscutting concerns, something not considered or supported in existing aspect systems. We introduce aspect-oriented support for multi-stage languages by identifying three aspect types for the staging pipeline, namely pre-, in- and post- staging. We discuss their implementation in a language supporting compile-time metaprogramming, where aspects are realized as batches of AST transformation metaprograms, accompanied by an AOP-specific library. We also provide example scenarios where the proposed aspect types may be used in practice. Finally, we show how full-scale source-level aspect debugging is facilitated during the program compilation process.


Aspect-Oriented Programming; Multi-Stage Languages; Metaprogramming

Cite as:

Yannis Lilis, Anthony Savidis, “Aspects for Stages: Cross Cutting Concerns for Metaprograms”, Journal of Object Technology, Volume 13, no. 1 (March 2014), pp. 1:1-36, doi:10.5381/jot.2014.13.1.a1.

PDF | DOI | BiBTeX | Tweet this | Post to CiteULike | Share on LinkedIn