First, I notice that there is a "typo" in the demo.  The "include ModB" should 
be "include ModA".

On Tuesday 14 March 2006 11:56 pm, Charles O Nutter wrote:
> Ahh, here's my theory, based on a quick look.
>
> It's because of the lazy loading of methods!!! Huzzah! I knew this one
> would come around to bite us eventually.

I can easily believe that one.

> Because we rely on method_missing to trigger Java methods to be loaded, if
> Object has a method that we want to use in an included Java class, we'll
> never reach it. We will search all the way to the top of the JavaProxy's
> hierarchy and eventually find the real method before we ever trigger
> method_missing.

But why should defining a mehod "at the outside a class", affect the Object 
class?

>
> SO. We need to fix it. The solution Tom and I kicked around was to take the
> list of methods from the Java class and load some faux methods into the
> list, so that "methods" returns an appropriate list and so that we don't
> depend on method_missing tricks. When we do actually call those methods,
> we'll prime them then.
>
> Until then I'm not sure there's an easy fix...
>
> - Charlie
>
> On 3/14/06, David Corbin <[EMAIL PROTECTED]> wrote:
> > The arity for list.add is coming from ModA#add, without any real reason
> > to be.
> > I'm not sure if this is "special case for the 'default' object", or not.
> >
> > ---cut----
> > require 'java'
> > include_class 'java.util.ArrayList'
> >
> > module ModA
> >
> >     def add a,b,c
> >     end
> >
> > end
> >
> > include ModB
> >
> > list = ArrayList.new
> > list.add "Foo"
> > ---end---
>
> --
> Charles Oliver Nutter @ headius.blogspot.com
> JRuby Developer @ jruby.sourceforge.net
> Application Architect @ www.ventera.com


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Jruby-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jruby-devel

Reply via email to