AspectScript is a JavaScript extension for Aspect-Oriented Programming (AOP) that currently supports Mozilla Firefox, Safari, Chrome, and Opera (no plug-ins or add-ons required!). AspectScript is an aspect language that integrates with the characterizing features of JavaScript such as first-class and higher-order functions, dynamic typing, and prototype-based programming. AspectScript is based on the pointcut-advice mechanism and includes the followings state-of-the-art AOP features:

Despite the numerous aspect-oriented features of AspectScript, it is still very easy to use, thanks to sensible default semantics. For instance, to define an aspect that shows a message before calls to the foo function, it is only necessary to write:

var pointcut = AspectScript.Pointcuts.call(foo);
var advice   = function() {
 alert("Calling foo");
};
AspectScript.before(pointcut, advice);

Target audience

We are convinced that AspectScript can be useful for both researchers and developers:

Credits

AspectScript is designed and implemented at the Pleiad lab by Paul Leger and Rodolfo Toledo, under the supervision of the professor Éric Tanter.