Title: An Untyped Calculus of AspectOriented Programs
1An Untyped Calculus of Aspect-Oriented Programs
- Radha Jagadeesan
- Alan Jeffrey
- James Riely
- DEPAUL UNIVERSITY, CHICAGO
2Aspect Oriented Programming
- AOSD. Systematic methodology to address
cross-cutting concerns - A standard example logging
- AOP. Language support to localize cross
cutting code - This talk. About AOP languages
3Specification via translation
- Weaving describe operational semantics of a AOP
language via compilation to the underlying
paradigm. - Aspect Java ! Java
- Aspect Scheme ! Scheme
- Aspect ML ! ML
- Aspect C ! C
4AOP languages and OO languages Folklore
- Execution in OO languages is an instance of
execution in AOP languages - Translation from OO programs P
- to AOP program Pasp
- P1 ! P2 , P1asp ! P2asp
5AOP languages and OO languages Folklore
- Execution in OO languages is an instance of
execution in AOP languages - Aspects interfere with OO principles
6Aspects interfere with OO programming
D1, D2 are distinguishable.
7Aspects as first class entities?
-
- Source semantics is non-trivial.
- Aspects OO redundancy
- Aspects interfere with OO principles
8Rest of the talk
Overview of results A sketch of the technical
development
9A calculus of AO programs
- Identify a core set of orthogonal primitives
- Only AROUND advice
- No method bodies
- Only call/execution pointcuts
- Direct description of the operational semantics
of aspect based programs
10So what?
- Dynamic arrival of new advice permitted.
11Specification of weaving
No reductions are lost
No new reductions
12Limitations
- Limited vocabulary of pointcuts.
- Only call/execution join points
- Reflection, cflow not included
- Global specification of advice order
13Rest of this talk A sketch of the main ideas
- An overview of call vs. execution
- The aspect calculus
- Weaving
14An Advised Method call
u.foo()
oC
a
proceed()
o.foo(u)
uD
15An Advised Method call
u.foo()
oC
a
proceed()
o.foo(u)
uD
16Call advice
- Executed in the controlling context of the caller
17An Advised Method call
u.foo()
oC
a
proceed()
o.foo(u)
uD
18Execution advice
- Executed in the controlling context of the callee
19Rest of this talk
- An overview of call vs.. execution
- The aspect calculus
- Weaving
20The Aspect Calculus
- Class declarations
- Pointcuts
- Advice
21The Aspect Calculus Classes
Class list of method names Methods have no code
22The Aspect Calculus Pointcuts
23The Aspect Calculus Advice
Given fixed global ordering on advice names
24Reduction rules context
25Reduction rules fetching advice
Keep track of controlling object p Call
advice determined by static type. Execution
advice determined by dynamic type
26Reduction rules call advice
Controlling context of caller p Substitutions
for this, target proceed,
parameters
27Reduction rules execution advice
Controlling context of callee o Substitutions
for this, target proceed,
parameters
28Encoding Class Based Language 1
Create an exec advice for each method body
29Encoding Class Based Language 2
Name cbl_d_m precedes name cbl_c_m in ordering
on advice names
proceed
cbl_c_m
cbl_d_m
30Rest of this talk
- An overview of call vs. execution
- The aspect calculus
- Weaving
31Weaving
Programs that dynamically load advice affecting
existing classes cannot be woven statically.
For static advice, weaving algorithm is (by
now) standard. Novelty is specification of
weaving.
32Weaving Basic idea
- View as a kind of macro-expansion.
- To weave
Weave recursively
and associate result to the body of method m
33Weaving
- Alas. This doesnt necessarily terminate.
- However, postpone macro-expansion to runtime by
freezing inside method bodies. - Formalized in paper.
34A subtlety in correctness proof
Weaving of intermediate configurations requires
knowledge of controlling object
35Rest of this talk
- An overview of call vs. execution
- The aspect calculus
- Weaving
- Summary
36This talk A calculus of AOP programs
- Identify a core set of orthogonal primitives
- Direct description of the execution of programs
in an aspect language.
37Moving along
- Scale Larger variety of pointcuts.
- Accurate treatment of advice order.
- Source level typing