[aosd-discuss] Is return statement ignored in advice?
Bram Adams
bram.adams at ugent.be
Fri Aug 17 17:58:14 EDT 2007
Hi,
Op 17-aug-07, om 19:35 heeft Gregor Kiczales het volgende geschreven:
> In my experience, confusion about this comes up when people are
> thinking
> about AspectJ advice using a 'pre-processor' or 'code injection'
> semantic
> model.
Not necessarily. At the SPLAT workshop during AOSD '07, we presented
a paper about an AOP implementation of idiom-based exception handling
in a huge C system (http://www.aosd.net/workshops/splat/2007/papers/
adams.pdf). Our work was based around the notion of "local
continuation join point", i.e. a new kind of join point representing
the future of a program after conclusion of another join point J, but
constrained to J's enclosing execution join point.
Consider a call to procedure g within a procedure f. The local
continuation join point L of the call to g models everything which
will happen inside f after the call to g returns. If one advises L
with around advice, then one is able to control whether the execution
of g is completed or not. In the latter case, one effectively stops
the execution of a procedure from within advice, but in a more fine-
grained way than around-advising a normal call or execution join
point allows. Major application of this is exception handling in C,
because aspects enhanced with local continuation join points can
express this in an easier to understand, more high-level way than
e.g. setjmp/longjmp. At the same time, implementation of the local
continuation join points is rather straightforward and can be made
efficient (http://users.ugent.be/~badams/aspicere2/).
How does all this relate to this email thread? The combination "local
continuation join point + around advice" can actually be expressed
very succinctly by introducing a new keyword inside advice, inspired
by "break". If this statement is reached, both the advice as well as
the advised call join point's enclosing procedure are aborted (one
does not need to write a separate advice anymore on the call join
point's local continuation joinpoint). The guys of ACC (http://
aspectc.msrg.utoronto.ca/ACC) applied this idea with their preturn()
construct, which is a return statement stopping both advice and base
procedure.
Bottom line: attaching more semantics to a return statement inside
advice makes sense from a pure AOP perspective (as opposed to a
program transformation kind of view), especially in (but not limited
to) older languages like C.
Kind regards,
Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)
More information about the discuss
mailing list