[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspectj-users] If pointcut and side effects
- From: "Jon S. Baekken" <jbaekken@xxxxxxxxxxxx>
- Date: Thu, 1 Jun 2006 13:49:01 -0700
- Delivered-to: firstname.lastname@example.org
Is it correct then to say that in the absence of if pointcuts with
side effects, the evaluation order does not matter? No other pointcut
than if can have side effects?
I understand you wonder where I want to go with this :) I'm doing
analysis of control and data dependencies in relation to faults in
pointcuts, and in such a scenario it could be useful to be able to
state things about control and data dependencies between the
different conditions of a pointcut. But relying on implementation
decisions is probably a bad thing anyway.
On May 31, 2006, at 9:00 PM, Eric Bodden wrote:
Why was this decision made? For better/faster implementation? From a
usability point of view, one would certainly like to have control
the evaluation order (especially since AspectJ is an augmentation of
Java where boolean expressions have a defined order).
Using the same "lazy/jumpingcode" evaluation technique for
you know it from Boolean expressions would not make much sense,
the following reason. Imagine the following three pointcuts:
pointcut p1(int i): args(i) && if(i>2) && call(* Foo.*(int));
pointcut p1(int i): if(i>2) && args(i) && call(* Foo.*(int));
pointcut p2(int i): call(* Foo.*(int)) && args(i) && if(i>2);
I think we both agree that those two pointcuts should always match the
same joinpoints. If you now evaluated p1 as you suggest, that means
first at *any* method with an int argument we have to bind this
argument, check if it's >2 and then last but not least we check if
method is actually in class Foo at all. Would make no sense, would it?
Just imagine the runtime overhead. Pointcut p2 would be even worse:
would access i before having it bound! Consequently, any sensible
compiler will generate the residues in the order depicted by pointcut
p3. This would lead to dynamic residues only be inserted in inside the
class Foo and with the appropriate signature. Also, values being
accessed by if pointcuts will be bound, since if pointcuts are
Are there any simple rules that can be stated about evaluation order
given the current (eclipse) implementation of AspectJ? (I know I
shouldn't rely on them but I'm curious)
No, and there should not be any rules. It's an *if* pointcut, meant to
evaluate a sideeffect-free Boolean expression and for nothing else.
really wondering what you are trying to achieve by this technique. I
never found a need for such a thing.
Sable Research Group, McGill University
aspectj-users mailing list