"Hal Fulton" wrote: > > Here are my comments on Matz's plan: > > [...] > > 3. It strikes me that wrap is really the only one > necessary. It could do all the work of pre and post. > Yet I suppose the others are good from the standpoint > of clarity. > A similar argument might be made for attr_accessor - making attr_reader & attr_writer unnecessary. OK, there's a ton of reasons why "that's not the same thing" (the best reason I can think of is that "they're not the same thing";). Whereas attr_* contains overlapping functionality, hooking doesn't appear to suffer in the same way. Wrap is a controlling 'outer' wrap. The combination of pre/post would be a benign 'inner' wrap. Benign in the sense that you could safely assume that you wouldn't accidentally be changing the program's logic. Here (#+#) is the statement I add when I'm about to wreck logic: class Roo def r 7 * 6 #+# print 'r done ... ' end end p Roo.new.r # -> 42 #+# p Roo.new.r # -> r done ... nil If I understand :post, I should be able to add the method by: class Roo def r:post print 'r done ... ' end end p Roo.new.r # -> r done ... 42 > 4. I'm a little bothered that 'post' is not able to > know the return value of the method even though the > method has returned. But if :wrap is also defined, its back-end is about to get control. If you want to know the return value, the only sensible place to find out is in :wrap because you might leave it as it is, or change it, and it can't(?) be changed any later. > > Just my thoughts. > > Hal > I'm just adding by trivial example that :pre or :post will be better to use when :wrap might be over-kill. Acknowledgements to Guy and/or CLOS language. daz