Aaron Sherman wrote: > All of this is still coming into focus for me, and I want to spend > more time reading the articles later, but for now I just wanted > to see if anyone else has been thinking these thoughts....
I do like the idea of AOP; but I think the mechanism you suggest are too clumsy. The particular weave that you are attempting is to add before- and after- functions to a set of existing functions. Ideally, this shold be imposed on the functions from outside. Otherwise you are simply proposing an aternative syntax for function calls within the sub body. I'm thinking of a mechanism more like: Class A; sub foo { ... } sub bar { ... } Class B; sub pre is before (A::foo, A::bar) { print "about to enter $(caller.name)\n"; } sub post is after (A::foo, A::bar) { print "leaving $(caller.name)\n"; } Class C; sub another { ... } &another is after (A::foo, B::pre); A good reflection mechanism makes it easy to write code that finds all the methods on a class, so the requirement for a list of method names is not onerous even when you want to apply an after- function to all the methods of a class. There are, of course, a number of issues to consider. Is C<caller> the correct context for the woven function? What order do multiple before/after functions get called in? How do they interact with inheritance? Ideally, it should be possible to write a precondition (assertion) checker in a base class that is inheritied when its method is overridden in a subclass As you said, these are still early ideas. Dave. -- Dave Whipp, Senior Verification Engineer, Fast-Chip inc., 950 Kifer Rd, Sunnyvale, CA. 94086 tel: 408 523 8071; http://www.fast-chip.com Opinions my own; statements of fact may be in error.