From: Ned Konz Date: 2001-09-28T01:50:28+09:00 Subject: [ruby-talk:21781] Re: Transparent Proxies On Thursday 27 September 2001 09:28 am, Paul Brannan wrote: > The reason SimpleDelegate is so slow is that it must create new delegate > methods every time a new object is created; DelegateClass(Foo) does this > only once, when the class itself is created. However, if Foo changes > (i.e. if methods are added or removed) then DelegateClass(Foo) will not > not get the new methods, and it will still try to delegate the removed > methods. There is another way to handle the proxy problem: use method_missing to catch undefined methods, and in method_missing use eval to define the delegation method. That way, you don't have the startup delay of SimpleDelegator, and methods only incur the compilation penalty once. -- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com