[#94657] [Ruby master Feature#16131] Remove $SAFE, taint and trust — naruse@...
Issue #16131 has been reported by naruse (Yui NARUSE).
3 messages
2019/08/29
[ruby-core:94377] [Ruby master Bug#16106] UnboundMethod owner points to base class
From:
sbellware@...
Date:
2019-08-16 00:57:32 UTC
List:
ruby-core #94377
Issue #16106 has been updated by sbellware (Scott Bellware). Indeed, that's why I was surprised. I wasn't expecting `owner` to be a pointer to a class that I wasn't working with. To correct the code I was working on, I now pass around both the UnboundMethod instance as well as the class, and ignore the `owner` method entirely. I guess what also throws me, from a usability perspective, is that `owner` seems asymmetrical with Method#receiver, where Method#receiver is a pointer to the de facto instance that the method is from. I appreciate that this is largely immaterial due to the difference between objects and classes, but just a bit of background on what was informing my biases at the time. Ideally, it might have been nice to have a method named `implementer` on UnboundMethod that does what `owner` does, and have `owner` reflect some symmetry with Method#receiver. Just a thought. ---------------------------------------- Bug #16106: UnboundMethod owner points to base class https://bugs.ruby-lang.org/issues/16106#change-80792 * Author: sbellware (Scott Bellware) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin17] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- This may not be a bug. It may be my misinterpretation of the feature. When using UnboundMethod#owner on a class that was created with `Class.new(SomeBaseClass)`, the owner is reported as the `SomeBaseClass `rather than the new class. This was a surprising outcome, since I presumed that the owner method would point to the class rather than the class's base class. Example: ``` class SomeClass def some_method end end C = Class.new(SomeClass) m = C.instance_method(:some_method) pp m.owner # => SomeClass # I would have expected the owner to be C ``` Is this expected behavior? Thanks, Scott ---Files-------------------------------- unbound_method_owner_sketch.rb (176 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>