From: daniel@...42.com Date: 2021-03-02T15:31:02+00:00 Subject: [ruby-core:102718] [Ruby master Feature#17660] Expose information about which basic methods have been redefined Issue #17660 has been updated by Dan0042 (Daniel DeLorme). Does this work with refinements? ```ruby module X refine Integer do def +(x); x ** self; end end end ``` In that case `RubyVM.redefined_basic_methods` should only return `{Integer=>[:+]}` if it's called from a context where the refinement is active? Or is this irrelevant to the use case? I'm not sure what's the use case precisely. Is the purpose only to forbid redefinitions that would negatively affect performance? ---------------------------------------- Feature #17660: Expose information about which basic methods have been redefined https://bugs.ruby-lang.org/issues/17660#change-90714 * 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: