It depends. You can certainly implement it like that (that's basically what things like AspectJ do).
You can also do it dynamically at runtime (e.g. with Hook::Lexwrap in Perl - which is basically what Aspect does.)
What a full AOP system gives you is the ability to do it in a structured way - making maintenance less of a nightmare.
| [reply] |
This certainly is programming on the meta level and it seems for me it is like adding some reflectivity to the programs. That's why it fits so well for logging the behaviour of the program.
| [reply] |
I would look at AOP slightly differently, at least from a Perl point of view. It allows you to inject a bunch of arbitrary opcodes at any defined point in the optree. Consider them more like database triggers. "When [OPCODES], then [MY STUFF]." So, you could have:
- "Do [MY STUFF] before [OPCODES]"
- "Do [MY STUFF] after [OPCODES]"
- "When [OPCODES], do [MY STUFF] in between OPCODE1 and OPCODE2"
- "When [OPCODES], replace [OPCODE1] with [MY STUFF]"
Right now, we would do this using source filters, similar to what adrianh has done. But, the "Real Way" would be to provide opcode-filters. I'm not sure if Perl6 will seamlessly provide for this, or not. You will be able to do it in Perl6, though, because you will have access to the optree, even if it's after the compile step.
------ We are the carpenters and bricklayers of the Information Age. The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6 Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
| [reply] [d/l] [select] |