[#108552] [Ruby master Bug#18782] Race conditions in autoload when loading the same feature with multiple threads. — "ioquatix (Samuel Williams)" <noreply@...>
Issue #18782 has been reported by ioquatix (Samuel Williams).
11 messages
2022/05/14
[ruby-core:108688] [Ruby master Feature#18798] `UnboundMethod#==` with inherited classes
From:
"ko1 (Koichi Sasada)" <noreply@...>
Date:
2022-05-25 00:28:24 UTC
List:
ruby-core #108688
Issue #18798 has been updated by ko1 (Koichi Sasada). Backport deleted (2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN) ruby -v deleted (ruby 3.2.0dev (2022-01-14T04:46:12Z gh-4636 c613d79f9b) [x64-mswin64_140]) Tracker changed from Bug to Feature Ah, yes, it is a feature request. ---------------------------------------- Feature #18798: `UnboundMethod#==` with inherited classes https://bugs.ruby-lang.org/issues/18798#change-97729 * Author: ko1 (Koichi Sasada) * Status: Open * Priority: Normal ---------------------------------------- Now `UnboundMethod` for a same method from a superclass and an inherited class are not `==`. ```ruby class C def foo = :C $mc = instance_method(:foo) end class D < C $md = instance_method(:foo) end p $mc == $md #=> false p $mc.owner #=> C p $mc.owner == $mc.owner #=> true p $mc.source_location == $mc.source_location #=> true p $mc.inspect #=> "#<UnboundMethod: C#foo() t.rb:3>" p $md.inspect #=> "#<UnboundMethod: D(C)#foo() t.rb:3>" ``` How about to make it `UnboundMethod#==` return true for this case? Rule: "return true if the UnboundMethod objects point to a same method definition" seems simple. FYI: On aliased unbound methods point to a same method are `==`. ```ruby class C def foo = :C alias bar foo $mfoo = instance_method(:foo) $mbar = instance_method(:bar) end p $mfoo, $mbar #=> #<UnboundMethod: C#foo() t.rb:2> #=> #<UnboundMethod: C#bar(foo)() t.rb:2> p $mfoo == $mbar #=> true ``` -- 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>