[#111472] [Ruby master Bug#19274] Error installing ruby 3.2.0 on RH 8 — "aalllop (Alberto Allegue) via ruby-core" <ruby-core@...>
Issue #19274 has been reported by aalllop (Alberto Allegue).
5 messages
2022/12/28
[#111508] Data support for versions before 3.2.0 — Eustáquio Rangel via ruby-core <ruby-core@...>
I was wondering that every piece of code (gems, etc) that use the new Data =
3 messages
2022/12/29
[ruby-core:111104] [Ruby master Bug#19079] Modules included in a DelegateClass cannot override delegate methods
From:
"matz (Yukihiro Matsumoto)" <noreply@...>
Date:
2022-12-01 05:11:54 UTC
List:
ruby-core #111104
Issue #19079 has been updated by matz (Yukihiro Matsumoto).
Status changed from Open to Rejected
The `DelegateClass` defines an anonymous class and defines forwarding methods to the class. The reported (so-called) issue is a natural consequence of the above behavior. `include` add methods defined in a module **above** the current class, so forwarding methods have higher precedence. If you (re)define a method, it overwrites the forwarding method.
My opinion is that your assumption is wrong, so we don't need to fix. If you think we need to implement your assumption, you need to persuade us with the real world use-case.
Matz.
----------------------------------------
Bug #19079: Modules included in a DelegateClass cannot override delegate methods
https://bugs.ruby-lang.org/issues/19079#change-100371
* Author: jonathanhefner (Jonathan Hefner)
* Status: Rejected
* Priority: Normal
* ruby -v: ruby 3.1.2p20
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
Because `DelegateClass` defines delegate methods on the class itself, those delegate methods come first in the method lookup chain. This prevents included modules from overriding delegate methods:
```ruby
Base = Class.new do
def foo
"base"
end
end
Helper = Module.new do
def foo
"helper"
end
end
WithHelper = DelegateClass(Base) { include Helper }
WithHelper.new(Base.new).foo
# => "base"
```
One possible solution would be to define the delegate methods in a separate module. That way, other modules could come before it in the method lookup chain.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/