Jruby name lookup


#1

I am posting this example again.
It seems to show that jruby’s name lookup model is not the same as
MRI’s.

module MyModule
class MyClass
def self.my_method
puts “old”
end
end
end

include MyModule

class MyClass
def self.my_method
puts “new”
end
end

MyClass.my_method
::MyModule::MyClass.my_method

MRI says :
new
new

jruby says
new
old

So, either jruby considers MyClass as a new constant (instead of looking
in the included module), or jruby’s ‘class’ method works in its own way
(for java reasons ?).

Is the class/module hierarchy model included in the (virtual) ruby
specifications ?