page1
class Target {
public:
void f() {
// do something
}
};
Target.h
#include “Dump.ah“ // the slice
#include “Target.h“ // for last_
aspect Problem {
Target *last_;
// refer to slice in Dump.ah:
advice “Target“: slice Dump;
// advice that needs Target:
advice execution(“Target“) :
after () {
last_ = tjp->that();
last_->dump();
}
};
Problem.ah
include
source code
weaving (ac++)
#include “Target.h“ // for last_
class Problem {
Target *last_;
void transformed advice {
// needs Target, thus Target.h
}
};
Problem.ah
woven code
#include “Dump.ah“
class Target {
void transformed dump {
// needs stdio
}
public:
void transformed f {
// do something
}
};
Target.h
no include cycle!
generated include (needed for the slice, which depends on stdio.h)
#include <stdio.h>
slice class Dump {
void dump() {
// print object
}
};
Dump.ah
include
#include <stdio.h>
// slice code removed by weaver
Dump.ah
include
include