Issue #17660 has been updated by marcandre (Marc-Andre Lafortune).


I don't object (actually I needed that method for tests in `backports` gem), but I wonder why a C method is preferable to a pure Ruby gem?

----------------------------------------
Feature #17660: Expose information about which basic methods have been redefined
https://bugs.ruby-lang.org/issues/17660#change-90633

* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Priority: Normal
----------------------------------------
I would like to tell if code is redefining methods that can impact
MRI's optimizations.  This commit exposes which basic methods have been
redefined.  For example:

```ruby
class Integer
  def +(x); x ** self; end
end

p RubyVM.redefined_methods # => {Integer=>[:+]}
```

This will allow us to prevent basic method redefinitions from happening
by checking for them in CI environments.  For example:

```ruby
Minitest.after_run {
  fail "Basic methods have been redefine" if RubyVM.redefined_methods.any?
}
```

---Files--------------------------------
0001-Expose-information-about-which-basic-methods-have-be.patch (3.89 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>