Bug #4502
closedstrange Module.new behaviour
Description
=begin
First I create a proc:
p = proc {
self::X = Class.new
def self.X
X.new
end
}
Then I create a module:
A = Module.new(&p)
puts A.X # => #<A::X:0x9c2e774>
Then I create another module:
B = Module.new(&p)
puts B.X # => #<B::X:0x9c39304>
Everything seems to be ok. But after module B was created (({A.X})) started to return instances of (({B::X}))
puts A.X # => #<B::X:0x9c38238>
When (({self::X.new})) is used instead of (({X.new})) everything works as expected.
More info can be found here http://www.ruby-forum.com/topic/1275717
=end
Updated by shyouhei (Shyouhei Urabe) over 13 years ago
- Status changed from Open to Assigned
- Assignee set to ko1 (Koichi Sasada)
=begin
=end
Updated by ko1 (Koichi Sasada) over 13 years ago
- Target version set to 2.0.0
This issue have complex problems. I'll fix it 1.9.4 or later.
Updated by ko1 (Koichi Sasada) almost 12 years ago
- Assignee changed from ko1 (Koichi Sasada) to nobu (Nobuyoshi Nakada)
nobu, could you check it?
I think you tried something like this issue.
Updated by nobu (Nobuyoshi Nakada) almost 12 years ago
With latest version, A.X occurs NameError instead of returning B::X.
Updated by nobu (Nobuyoshi Nakada) almost 12 years ago
- Status changed from Assigned to Closed