Bug #4502

strange Module.new behaviour

Added by Andy Bogdanov about 3 years ago. Updated about 1 year ago.

[ruby-core:<unknown>]
Status:Closed
Priority:Normal
Assignee:Nobuyoshi Nakada
Category:core
Target version:2.0.0
ruby -v:ruby 1.9.1p430 (2010-08-16 revision 28998) [i386-mingw32] Backport:

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 Updated by Shyouhei Urabe about 3 years ago

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

=begin

=end

#2 Updated by Koichi Sasada almost 3 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 over 1 year 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 over 1 year ago

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

#5 Updated by Nobuyoshi Nakada about 1 year ago

  • Status changed from Assigned to Closed

Also available in: Atom PDF