Bug #4502

strange Module.new behaviour

Added by Andy Bogdanov over 4 years ago. Updated almost 3 years ago.

Assignee:Nobuyoshi Nakada
ruby -v:ruby 1.9.1p430 (2010-08-16 revision 28998) [i386-mingw32] Backport:


First I create a proc:
p = proc {
self::X = Class.new
def self.X
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


#1 Updated by Shyouhei Urabe over 4 years ago

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



#2 Updated by Koichi Sasada over 4 years ago

  • Target version set to 2.0.0

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

#3 Updated by Koichi Sasada about 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 Updated by Nobuyoshi Nakada almost 3 years ago

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

#5 Updated by Nobuyoshi Nakada almost 3 years ago

  • Status changed from Assigned to Closed

Also available in: Atom PDF