Project

General

Profile

Bug #4502

strange Module.new behaviour

Added by Andy Bogdanov over 5 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
ruby -v:
ruby 1.9.1p430 (2010-08-16 revision 28998) [i386-mingw32]
[ruby-core:<unknown>]

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 # => #
Then I create another module:
B = Module.new(&p)
puts B.X # => #
Everything seems to be ok. But after module B was created (({A.X})) started to return instances of (({B::X}))
puts A.X # => #

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

History

#1 [ruby-core:35580] Updated by Shyouhei Urabe about 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to Koichi Sasada

=begin

=end

#2 Updated by Koichi Sasada about 5 years ago

  • Target version set to 2.0.0

This issue have complex problems. I'll fix it 1.9.4 or later.

#3 [ruby-core:50122] Updated by Koichi Sasada over 3 years ago

  • Assignee changed from Koichi Sasada to Nobuyoshi Nakada

nobu, could you check it?
I think you tried something like this issue.

#4 [ruby-core:51178] Updated by Nobuyoshi Nakada over 3 years ago

With latest version, A.X occurs NameError instead of returning B::X.

#5 [ruby-core:51717] Updated by Nobuyoshi Nakada over 3 years ago

  • Status changed from Assigned to Closed

Also available in: Atom PDF