[ruby-core:93080] [Ruby trunk Bug#15572] `RubyVM::InstructionSequence` doesn't work with `extend`.
From:
merch-redmine@...
Date:
2019-06-12 22:44:08 UTC
List:
ruby-core #93080
Issue #15572 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Closed
As wanabe pointed out, this isn't a bug. `load_iseq` is `undef` in the singleton class, which occurs before extended modules during method lookup. `prepend` on the singleton class works because prepended modules on the singleton class occur before methods in the singleton class itself during method lookup. Calling `super` in the prepended method results in a `NoMethodError`.
----------------------------------------
Bug #15572: `RubyVM::InstructionSequence` doesn't work with `extend`.
https://bugs.ruby-lang.org/issues/15572#change-78496
* Author: ioquatix (Samuel Williams)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
For some reason,`RubyVM::InstructionSequence.extend` doesn't seem to work as expected.
```ruby
module Loader
def load_iseq(path)
puts path
return compile_file(path)
end
end
# This doesn't work?
# RubyVM::InstructionSequence.extend(Loader)
# This works:
class << RubyVM::InstructionSequence
prepend Loader
end
```
--
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>