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:

  • Higher-order aspects: AspectScript is directly inspired by AspectScheme, in which aspects, pointcuts, and advices are first-class values. Consequently, they can be created and manipulated at runtime. An aspect in AspectScript is a pointcut-advice pair; pointcuts and advices are plain JavaScript functions. This feature allows programmers to use the full power of higher-order programming in AOP.
  • Dynamic deployment of aspects with scoping strategies: Aspects in AspectScript are dynamically deployed like in CaesarJ and AspectScheme. In addition, the scope of dynamically deployed aspects can be expressively refined using Scoping Strategies (AOSD'08, DLS'09).
  • Hybrid join point model: At its core, AspectScript adopts a join point model in the line of that of AspectJ (see the join point model), but tailored for the JavaScript language. However, AspectScript not only supports implicitly-generated join points following the language model, but also provides the possibility to define custom join points triggered explicitly, as in Ptolemy.

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 =;
var advice   = function() {
 alert("Calling foo");
AspectScript.before(pointcut, advice);
  • Do you want to see AspectScript in action? Please try the tetris game here.
  • Do you need more examples? You can find them here.
  • Do you want to learn more? You can follow our tutorial.
  • Do you have any doubt? Please, do not hesitate to ask in our mailing list.
  • Do you want to try AspectScript? Download it from here.
  • Did you find a bug? Do you have a feature request/suggestion? Please, use the AspectScript trac.

Target audience

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

  • For developers: AspectScript is a useful aspect language to modularize crosscutting concerns in the Web. Many common problems can be modularly solved using AspectScript! Take a look at the examples page.
  • For researchers: AspectScript provides an extensible testbed for the experimentation with new AOP features.


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

  • start.txt
  • Last modified: 2010/04/22 12:00
  • by aspectscript