> Now I believe you could simply have two dictionaries on Array and you
> would support the appropriate lookup semantics for class vs instance
> methods. But would you be able to support all the following scenarios?
>
> class << Array; def foo; "hello"; end; end; Array.hello => "hello"
>
> def Array.foo; "hello"; end; Array.hello => "foo"
>
> class Array
>    class << self
>      def foo
>        "hello"
>      end
>    end
>
>    def self.bar
>      "goodbye"
>    end
> end
> Array.foo => "hello"
> Array.bar => "goodbye"

I believe that a single class object that contains an instance method dictionary and a class method dictionary should handle all of these cases. The implementation is a bit trickier though. Thanks for sending along these scenarios though, it helps me think through these cases in more detail.

> This is just a sampling of metaclass weirdness...when you get into
> Class.new(...) tricks and marshalling, it gets more complicated.

If you have any more scenarios of strange behavior that may force the parallel class object and virtual class object hierarchy, please pass them along. If I understand you correctly, JRuby essentially keeps the same object model for classes as MRI?

Thanks,
-John