This is an old revision of the document!
AspectScript
AspectScript is a JavaScript extension for Aspect-Oriented Software Development (AOSD) that is currently working over Mozilla Firefox Browser. This extension is an aspect language, which integrates (with) main !JavaScript features such as first-class and higher-order functions, dynamic typing, and prototyped-based programming. AspectScript is based on the pointcut-advice mechanism and considers the followings hot state-of-the-art AOP features:
- Higher-Order Aspects: Like AspectScheme, AspectScript aspects are first-class values, which are pairs of pointcut-advice. Pointcuts and advices are 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 AspectScript, the base code is executed in the base level (level 0) and aspects (pointcuts and advices) are executing in a high level (level 1), which observe the base level. However, AspectScript permits to modify execution levels of base code and aspects using the aspects in Order semantics, that is to say, developers can choose in what level the base code is executed and what levels the aspects can see.
- Dynamic deployment of aspect with scoping strategies: Aspects of AspectScript are dynamically deployed like in CaesarJ and AspectScheme. In addition, the deployment of aspects can be managed using expressive scoping strategies.
- Control of aspect reentrancy: As in most aspect languages, it is possible to have aspect reentrancy problems in AspectScript. As a result, AspectScript allows programmers to control aspect reentrancy in a fine-grained manner.
Despite AspectScript features, this aspect language has a scalable easiness of use. For instance, we just need to define an aspect that shows a message before that the foo function is called, we need to write down:
AspectScript.before(AspectScript.Pointcuts.call(foo), function() { alert("Calling foo"); });
Do you need more examples? You can find here.
AspectScript can download and install from here.
We do not have a tutorial yet, we think that this technical report can be useful for this purpose.