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:

  • 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 deployment of aspects can be expressively refined using Scoping Strategies.
  • Hybrid join point model: At its core, AspectScript adopts a join point model in the line

of that of AspectJ, 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.

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 .

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.1255560147.txt.gz
  • Last modified: 2009/10/14 19:42
  • by aspectscript