There are certain cases in aspect-oriented systems, where some built-in language features are required to restrict the scope of matching of the patterns. For example, in AspectMatlab we use loop iterator variables to identify loops. The question might arise that names for loops iterator variables are often very general (for example, i or j), so we might end up over-matching loops unintentionally. The within pattern comes in very handy in such situations to restrict the scope of matching to specific constructs.
AspectMatlab supports a list of MATLAB constructs, such as function, script, class, aspect and loops.
Listing 8 presents examples of different cases of the pattern.
The pWithinFoo pattern will match every kind of join point, only inside the function
foo. Similarly, the pWithinBar pattern will match every join point inside
the script bar and the pWithinMyClass pattern will match every join point inside
the class myClass. The pWithinLoops pattern captures all join points within all
the loops. Lastly, pWithinAllAbc will restrict the scope to all kinds of constructs,
which are named abc.
![]() |
Toheed ASLAM 2010-04-24