On Monday 01 December 2003 12:25 am, Peter wrote: > First a note: I think intrinsic and extrinsic got swapped between the > first mention of it and now. Maybe we should try to get these things > straight to avoid unnecessary misunderstandings. A wrap was intrinsic, > because it was an intrinsic part of the semantics of a method, and pre and > post were extrinsic because they were really just riding along quietly. > That sounds logical to me. By this definition I assume above you meant > extrinsic, right? We could also choose some other terms that are harder > to mix up... I was thinking about the terms. To really distinguish these two types of wraps for what they do I think the following terms, or similiar terms, would really nail them down and prevent any confusion, and also help us think about them better: watch -or- monitor = extrinsic/outer wrap submethod = intrinsic/inner wrap Does this work for you? Also I was wondering, how do we get the results of super with the following code? watch foo(*args) pre a = something # blah post print a # blah2 end end Note that I used watch instead of pdef just to see what it would look like. Of course this notation also has the sticking point of what happens if pre and post aren't given (error?) and also how does super wrapping fit into this? Also, in thinking about the purpose of a "watch wrap" it occurs to me that it could still potentially effect the object (eg. @a = x) which I'm thinking should probably be beyond its "write scope". So perhaps it should be enclosed in some sort of object-specifc read-only namespace? Kind of like Matz' proposal: http://www.rubyist.net/~matz/slides/rc2003/mgp00029.html But applicable to methods. In other words a "watch" should have access to the global namespace, but only read access to the local object's namespace. So a "watch wrap" is equivalent to a "submethod" using this kind of namespace restriction: (using my repeated definition syntax from the RCR) def foo(*args) namespace self a = something # blah r = escape { super } print a # blah2 end end Where 'namespace self' means that any effects on the object self, made within the namespace are "rolled back" at the end. But 'escape' means the namespace doesn't apply to what happens in its block. This is a bit confusing, I know. Really just thinking out-loud here. I hope the concepts I'm trying to convey make sense though. -t0