Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] If and loop pointcuts

Hello,

I agree with Gregor about the problem of having pointcuts that could identify specific loops, which have no names.

Moreover, as I said at AOSD 2004, a for-loop pointcut would also be a big change in AspectJ (both language and compiler). One could imagine a for-loop pointcut of the form "for (<init> ; <condition> ; <increment>)" with the equivalent of an "arg" construct to get the 3 parts, and something like "proceed()" to execute the loop-body. For parallelisation (and presumably for other applications), an interesting for-loop pointcut would be able to "reconstruct" the iteration space. However, these 3 parts are not objects nor values (as they picked up by "arg"), but instructions. There is no constraint on their semantics. Usually, a for-loop would be written as "for ( VAR = MIN ; VAR <= MAX ; VAR += STRIDE)", and it would be interesting to have a pointcut that picks out MIN, MAX, STRIDE and VAR. But not all the loops follow this form, and analysing the code to predict something compliant with this form (when possible) would be quite a big change to AspectJ's pointcut mechanisms.


Bruno.

(I didn't see the Virigina examples, so I can't comment on them.)


Gregor Kiczales wrote:
At the AOSD conference, Kevin Sullivan was demoing some work by a
student from University of Virginia, showing a good use of if and
loop join points. Was that the paper you were reading?

At the time we finalized the join points for AspectJ 1.0, we had
never seen reasonable uses of such join points. But the application
shown at AOSD shows that there is at least one such use.

As usual, the key issue is to have pointcuts that pick them out in
reasonable ways, rather than by fragile properties such as "1st if
in the method named foo". The examples I saw at AOSD picked in
terms of which direction the branch takes (true/false). They used
this to do code coverage.

I bet that if more reasonable uses show up, these join points and
pointcuts could make it into a future version of AspectJ. But, as
nice as the Virginia examples are, it would be good to seem some
more before doing this.

But since AspectJ is open source, its an easy thing for someone
to try.


-----Original Message-----
From: aspectj-users-admin@xxxxxxxxxxx [mailto:aspectj-users-admin@xxxxxxxxxxx] On Behalf Of Johanne Leduc
Sent: Friday, April 16, 2004 12:34 PM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] If and loop pointcuts


Hello,

I read an article on AOP and AspectJ that mentioned, when explaining AOP principles, that the beginning of a loop is a possible joinpoint. I know it's not presently an AspectJ feature, but I was wondering if there are plans to one day have "if" statements and loops as pointcuts. I'd really appreciate any thoughts on this.

Thank you,
Johanne


Back to the top