[aspectc-user] if(...) in pointcut-expressions

Hans VB hans.vanbroeckhoven at telenet.be
Thu Jun 23 12:16:18 CEST 2005


Fabian Scheler wrote:

>Hi,
>
>I don't know if such a pointcut-function is planned for future
>releases of AspectC++, but what is wrong with:
>
>  
>
>>aspect foo {
>>    bool flag;
>>    pointcut bar() = call("% %::func()") && if(flag);
>>
>>    advice bar() : after() {
>>    
>>
>         if(flag) {
>           // advice stuff
>         }
>  
>
>>    }
>>
>>    advice ... : after() {
>>       // manipulation of flag
>>    }
>>
>>};
>>    
>>
This is how I implement it now. I probably should have told also that 
the pointcut and the manipulation of the flag are located in an abstract 
aspect. Thus, the 'user' of the subaspect shouldn't be bothered with 
adding this manually.

>or maybe the cflow() pointcut-function allows a proper solution for
>your problem, too.
>  
>
I don't think so for my particular need...

Anyway, there are still a number of features in AspectJ I'd like to see 
in AspectC++ also. For one, the ability to give advice to advice, as in 
the adviceexecution() pointcut-function in AspectJ. (or perhaps through 
added functionality of within(...) or cflow(...) (?)).

Greets,
Hans



More information about the aspectc-user mailing list