start

This is an old revision of the document!


AspectScript is a JavaScript extension for Aspect-Oriented Programming (AOP) that currently works in Mozilla Firefox. AspectScript is an aspect language that integrates (with) the main 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:

  • An extensible join model: The join point model is similar to the one found in AspectJ. However, it is possible to extend it to identify other points of interest through customizable join points, similar to Ptolemy.
  • Higher-order aspects: Like AspectScheme, AspectScript aspects are first-class values (a pair pointcut-advice). Pointcuts and advices are plain JavaScript functions, which are first-class values as well. This feature allows programmers to use the full power of higher-order programming to define and manipulate aspects.
  • Aspects in order: By default in AspectScript, the base code is executed at a base level (level 0). This level is observed by aspects, which in turn execute at an aspect level (level 1). However, in AspectScript, aspects can also observe higher levels (level 1 for instance), which causes their execution to happen in level 2. AspectScript permits to modify the default behavior of execution levels using the semantics presented in Aspects in Order, which gives complete control over which level a code is finally executed.
  • Dynamic deployment of aspects with scoping strategies: Aspects in AspectScript are dynamically deployed like in CaesarJ and AspectScheme. In addition, the deployment of aspects can be expressively refined using Scoping Strategies.
  • Control of aspect reentrancy: As in most aspect languages, it is possible to have aspect reentrancy problems in AspectScript. For this reason, AspectScript allows programmers to control aspect reentrancy in a fine-grained manner following the semantics of Controlling Aspect Reentrancy.

Despite the numerous AspectScript features, sensible default semantics make AspectScript very easy to use. 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);
  • Do you need more examples? You can find them here.
  • Does it seem complex? Do not give up!, 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 researchers: AspectScript provides an extensible testbed for the experimentation with new AOP features.
  • 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).

Credits

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

  • start.1254100011.txt.gz
  • Last modified: 2009/09/27 22:06
  • by aspectscript