From: Robert Klemme Date: 2006-12-28T03:20:06+09:00 Subject: Re: Contest: fastet way to redefine a method On 27.12.2006 17:59, Pit Capitain wrote: > What is the fastest way to redefine an existing method? > > With "fast" I don't mean the process of redefining the method, but the > time it takes to actually call the new implementation. So you mean runtime efficiency. > With "redefining an existing method" I mean changing the implementation > of an existing method so that in the new implementation it is possible > to call the old one and use its return value. I once cooked something together. The code is on Ruby Garden: http://wiki.rubygarden.org/Ruby/page/show/MethodHooks No idea about performance etc. At some point I stopped working on this because it was said that Ruby 2 will include a feature for this. I remember that there were some limitations (i.e. no suppport for blocks so far) but usability is ok IMHO. This was mostly an experiment. Kind regards robert