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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.