From: Tom Wardrop Date: 2010-12-23T15:24:56+09:00 Subject: [ruby-core:33826] [Ruby 1.9-Feature#3688] redef keyword for method redefinition in Ruby 2.0 Issue #3688 has been updated by Tom Wardrop. I came on here to suggest the exact same thing. As someone relatively new to Ruby (got into about 5 months ago), I'm surprised there's no easy way of achieving this given that so many developers seem to do this. It's what makes Ruby's dynamic nature so powerful. There are numerous ways in which this could be implemented. You could introduce a new special method like super, called 'old' which could either hold a reference to the old implementation, or maybe instead, it might just return the old implementation as a Proc object? I wouldn't want to see the 'super' method used for this purpose, as it may cause unpredictable behaviour. For example, what happens when you want to call the super class (the next implementation in the inheritance chain), but unexpectedly end up calling the old implementation which you'd thought you'd completely over-written. I also wouldn't want to see anything like redef which can clutter up classes. There just needs to be some simple, clean way of getting at an overwritten method. A common use case is monkey patching (such a feature as this one would go well with the 'refinements' idea), where you want to prepend or append an operation to an existing method, or where you want to modify the return value. I trust the Ruby developers and decision makers to come up with the most elegant and appropriate solution. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/3688 ---------------------------------------- http://redmine.ruby-lang.org