> I've recently joined this list, so please forgive me if I've missed
> something which has been hashed out before, but it's hard for me to
> see how Ruby can fit into how a JVM treats classes.  In a JVM, classes
> are static entities, once they are loaded their definitions cannot be
> changed.  But Ruby permits continual modifications to the definition
> of a class which affect even previously existing object of that class.
> How could this limitation in the JVM be dealt with?
>
> --Mirian
>

In my interpretation each ruby class would be an instance in java (say
RubyClass) and it's methods would be pluggable.  Each class object would act
as an instance factory for instances, which would also be able to plug
attributes and behaviors (as singletons).  I assume that's how it's
basically done in the
C version, but feel free to kill me for not reading the source before
responding here.  Pseudocode to illustrate only this point:

public class RubyClass  // just showing methods pretending all are public to
keep this simple
{   private RubyMethodFactory methodFactory;
    private RubyClass superclass;
    private String name;

    public RubyObject new(RubyObject[] args)
    {  return new RubyObject(args);
    }

    public RubyObject evaluate(String message, RubyObject[] args)
    {  RubyMethod method = methodFactory.get(message);
       if (method == null)
       {  if (superclass == null)
           {  return RUBY_NIL;  // or throw exception
           }
           return superclass.evaluate(message, args);
       }
       return method.call(args);
    }

    public void addMethod(RubyMethod method)
    {  methodFactory.add(method);
    }
}

public class RubyObject
{   private RubyClass class;
    private RubyMethodFactory methodFactory;

    RubyObject(RubyObject[] args)
    {  evaluate("initialize", args);
    }

    public RubyObject evaluate(String message, RubyObject[] args)
    {  RubyMethod method = methodFactory.get(message);
       if (method == null)
       {  if (class == null) return RUBY_NIL;
          return class.evaluate(message, args);
       }
       return method.call(args);
    }

    public void addMethod(RubyMethod method)
    {  methodFactory.add(method);
    }
}

Wayne