Forum: Ruby-core [ruby-trunk - Bug #7993][Open] owner of methods defined after using Module#prepend

C0225f8150e28b85666b511e0bbca258?d=identicon&s=25 no6v (Nobuhiro IMAI) (Guest)
on 2013-03-01 16:02
(Received via mailing list)
Issue #7993 has been reported by no6v (Nobuhiro IMAI).

----------------------------------------
Bug #7993: owner of methods defined after using Module#prepend
https://bugs.ruby-lang.org/issues/7993

Author: no6v (Nobuhiro IMAI)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"


=begin
The owner of methods defined after using Module#prepend seems to be
incorrect.

 RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"

 class C
   attr_reader :a
   prepend Module.new
   attr_reader :b
 end
 C.instance_method(:a).owner # => C
 C.instance_method(:b).owner # => #<C:0x00000000a52300>
 C.new.method(:a).owner      # => C
 C.new.method(:b).owner      # => #<C:0x00000000a52300>

 module M
   attr_reader :a
   prepend Module.new
   attr_reader :b
 end
 M.instance_method(:a).owner # => M
 M.instance_method(:b).owner # =>
 # ~> -:19:in `<main>': undefined method `class' for
#<M:0x00000000a515b8> (NoMethodError)
=end
0e610136db92027148906c92d57fdb36?d=identicon&s=25 marcandre (Marc-Andre Lafortune) (Guest)
on 2013-03-01 18:42
(Received via mailing list)
Issue #7993 has been updated by marcandre (Marc-Andre Lafortune).


Agreed. I described this in [ruby-core:52261], part of issue #7842.
----------------------------------------
Bug #7993: owner of methods defined after using Module#prepend
https://bugs.ruby-lang.org/issues/7993#change-37232

Author: no6v (Nobuhiro IMAI)
Status: Open
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"


=begin
The owner of methods defined after using Module#prepend seems to be
incorrect.

 RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"

 class C
   attr_reader :a
   prepend Module.new
   attr_reader :b
 end
 C.instance_method(:a).owner # => C
 C.instance_method(:b).owner # => #<C:0x00000000a52300>
 C.new.method(:a).owner      # => C
 C.new.method(:b).owner      # => #<C:0x00000000a52300>

 module M
   attr_reader :a
   prepend Module.new
   attr_reader :b
 end
 M.instance_method(:a).owner # => M
 M.instance_method(:b).owner # =>
 # ~> -:19:in `<main>': undefined method `class' for
#<M:0x00000000a515b8> (NoMethodError)
=end
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2013-12-18 04:49
(Received via mailing list)
Issue #7993 has been updated by nobu (Nobuyoshi Nakada).

Backport set to 1.9.3: DONTNEED, 2.0.0: REQUIRED


----------------------------------------
Bug #7993: owner of methods defined after using Module#prepend
https://bugs.ruby-lang.org/issues/7993#change-43733

Author: no6v (Nobuhiro IMAI)
Status: Closed
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"
Backport: 1.9.3: DONTNEED, 2.0.0: REQUIRED


=begin
The owner of methods defined after using Module#prepend seems to be
incorrect.

 RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"

 class C
   attr_reader :a
   prepend Module.new
   attr_reader :b
 end
 C.instance_method(:a).owner # => C
 C.instance_method(:b).owner # => #<C:0x00000000a52300>
 C.new.method(:a).owner      # => C
 C.new.method(:b).owner      # => #<C:0x00000000a52300>

 module M
   attr_reader :a
   prepend Module.new
   attr_reader :b
 end
 M.instance_method(:a).owner # => M
 M.instance_method(:b).owner # =>
 # ~> -:19:in `<main>': undefined method `class' for
#<M:0x00000000a515b8> (NoMethodError)
=end
5cf8f058a4c094bb708174fb43e7a387?d=identicon&s=25 nagachika (Tomoyuki Chikanaga) (Guest)
on 2013-12-29 16:38
(Received via mailing list)
Issue #7993 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 1.9.3: DONTNEED, 2.0.0: REQUIRED to 1.9.3:
DONTNEED, 2.0.0: DONE

r44175 and r44179 were backported to ruby_2_0_0 at r44345, and
additionally r44198 was backported at 44366.
See #9236 too.
----------------------------------------
Bug #7993: owner of methods defined after using Module#prepend
https://bugs.ruby-lang.org/issues/7993#change-43939

Author: no6v (Nobuhiro IMAI)
Status: Closed
Priority: Normal
Assignee:
Category: core
Target version:
ruby -v: RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"
Backport: 1.9.3: DONTNEED, 2.0.0: DONE


=begin
The owner of methods defined after using Module#prepend seems to be
incorrect.

 RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"

 class C
   attr_reader :a
   prepend Module.new
   attr_reader :b
 end
 C.instance_method(:a).owner # => C
 C.instance_method(:b).owner # => #<C:0x00000000a52300>
 C.new.method(:a).owner      # => C
 C.new.method(:b).owner      # => #<C:0x00000000a52300>

 module M
   attr_reader :a
   prepend Module.new
   attr_reader :b
 end
 M.instance_method(:a).owner # => M
 M.instance_method(:b).owner # =>
 # ~> -:19:in `<main>': undefined method `class' for
#<M:0x00000000a515b8> (NoMethodError)
=end
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2014-02-21 07:17
(Received via mailing list)
Issue #7993 has been updated by Nobuyoshi Nakada.

Description updated

----------------------------------------
Bug #7993: owner of methods defined after using Module#prepend
https://bugs.ruby-lang.org/issues/7993#change-45324

* Author: Nobuhiro IMAI
* Status: Closed
* Priority: Normal
* Assignee:
* Category: core
* Target version:
* ruby -v: RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"
* Backport: 1.9.3: DONTNEED, 2.0.0: DONE
----------------------------------------
The owner of methods defined after using Module#prepend seems to be
incorrect.

```ruby
RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"

class C
  attr_reader :a
  prepend Module.new
  attr_reader :b
end
C.instance_method(:a).owner # => C
C.instance_method(:b).owner # => #<C:0x00000000a52300>
C.new.method(:a).owner      # => C
C.new.method(:b).owner      # => #<C:0x00000000a52300>

module M
  attr_reader :a
  prepend Module.new
  attr_reader :b
end
M.instance_method(:a).owner # => M
M.instance_method(:b).owner # =>
# ~> -:19:in `<main>': undefined method `class' for
#<M:0x00000000a515b8> (NoMethodError)
```
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2014-04-22 09:43
(Received via mailing list)
Issue #7993 has been updated by Nobuyoshi Nakada.

Related to Bug #7987: Method#parameters should consider a prepended or
refined methd added

----------------------------------------
Bug #7993: owner of methods defined after using Module#prepend
https://bugs.ruby-lang.org/issues/7993#change-46289

* Author: Nobuhiro IMAI
* Status: Closed
* Priority: Normal
* Assignee:
* Category: core
* Target version:
* ruby -v: RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"
* Backport: 1.9.3: DONTNEED, 2.0.0: DONE
----------------------------------------
The owner of methods defined after using Module#prepend seems to be
incorrect.

```ruby
RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546)
[x86_64-linux]"

class C
  attr_reader :a
  prepend Module.new
  attr_reader :b
end
C.instance_method(:a).owner # => C
C.instance_method(:b).owner # => #<C:0x00000000a52300>
C.new.method(:a).owner      # => C
C.new.method(:b).owner      # => #<C:0x00000000a52300>

module M
  attr_reader :a
  prepend Module.new
  attr_reader :b
end
M.instance_method(:a).owner # => M
M.instance_method(:b).owner # =>
# ~> -:19:in `<main>': undefined method `class' for
#<M:0x00000000a515b8> (NoMethodError)
```
This topic is locked and can not be replied to.