From: shugo@... Date: 2020-12-09T08:54:27+00:00 Subject: [ruby-core:101336] [Ruby master Bug#17379] Refinement with modules redefinition bug Issue #17379 has been updated by shugo (Shugo Maeda). Assignee changed from shugo (Shugo Maeda) to matz (Yukihiro Matsumoto) It's an inline method cache issue and hard to solve without performance regression. If the behavior is not acceptable as a limitation of Refinements, it may be better to prohibit module inclusion in Refinements. ---------------------------------------- Bug #17379: Refinement with modules redefinition bug https://bugs.ruby-lang.org/issues/17379#change-89035 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * ruby -v: ruby 3.0.0dev (2020-12-05T10:40:00Z master 9dbb2bfd73) [x86_64-darwin18] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Depending on the circumstance, a refinement can be modified even after being used: ```ruby def foo [:base] end module M def foo super << :M end end module Ext refine Object do include M end end using Ext p 'asd'.foo unless ENV['SKIP'] # => [:base, :M] (ok) module M def foo super << :new_ref end end p 'asd'.foo # => depends (not ok) ``` Running this gives: ``` $ ruby refinement.rb [:base, :M] [:base, :M] # => ok $ SKIP=t ruby refinement.rb [:base, :new_ref] # => should be [:base, :M] ``` -- https://bugs.ruby-lang.org/ Unsubscribe: