From: Robert Feldt Date: 2001-03-06T13:45:30+09:00 Subject: [ruby-talk:12089] Re: Ruby & AOP On Tue, 6 Mar 2001, Robert Feldt wrote: > I agree (I guess problem is to find a bit to indicate > this. Idea to avoid this: have trap_calls introduce new nodes in the body > (first and last I guess) of the method to be trapped => no other stuff > needed? Well we have to > retain the node when method redefined but anyway...). > > Maybe change name of callback to 'on_trapped_call' and add > 'on_trapped_return'? > The above wasn't very clear so I'll try again (and in the process adds a feature to explicitly specify the callback): trap_calls :method1_to_be_trapped, ..., :with_callback is a directive that will change the method body of the methods to be trapped so that the callback is called with the original method body as a block. If done in interpreter (new node needed?) performance only suffers slightly and only on trapped methods. Should it be sticky (calls to callback stays there even if method redefined)? Maybe not since other directives frequently are not... No need for special callbacks that adds performance penalties to all method invocations... /Robert