On Wed, Mar 11, 2009 at 12:35 AM, Jochen Theodorou <[email protected]>wrote:

>
> John Rose schrieb:
> > On Mar 10, 2009, at 3:07 PM, Jochen Theodorou wrote:
> >
> >> What if an object comes from Java land into Groovy land and such a
> >> check
> >> has happened already?
> >
> > The injected interface would be defined and controlled by Groovy and
> > probably should be package-private.
>
> so it is an interface we cannot have as normal java code, but as at
> runtime created class? IMHO interfaces are public by default, so at last
> java the language won't work to define the interface... but won't stop
> us of course.
>
> > Even if it were public, so that random code could grab it and say "foo
> > instanceof GroovyInject", the first time it happens for foo's class
> > Foo, Groovy would be asked to fill in the GroovyInject methods on
> > Foo.  Basically, that would be Foo's entry into Groovy-land.
>
> ok, but where does that come from? How does it know it should ask
> Groovy? This part is unclear to me, but essential for the whole thing.
> If it is done with some kind of registry or bootstrap method, then I
> this is a bit of a problem for us, because the object might be asked for
> the interface before the bootstrapping is handled. If it is some spi
> like infrastructure we have a class loader problem.


What sets an injectable interface apart is that it has an injector
associated with it. The injector is to an injectable interface what the
bootstrap method is to a class that uses invokedynamic.
The injector for GroovyInject would be responsible for calling Groovy.

/Tobias

>
>
> But ok, these problems are nullified if the interface is generated at
> runtime I guess
>
> > (If for some reason this is too early, and it is a violation of some
> > usage rule, then Groovy could defer the question by throwing an error
> > of some sort; that would of course terminate the instanceof bytecode
> > abnormally.)
> >
> > After GroovyInject is injected, its getGroovyMeta method would
> > (presumably) return a constant customized Groovy metaclass tailored to
> > Foo.
>
> constant? well it if it has to return something constant, that is ok for
> me, it doesn't hinder us to use our non constant metaclasses ;)
>
> bye Jochen
>
> --
> Jochen "blackdrag" Theodorou
> The Groovy Project Tech Lead (http://groovy.codehaus.org)
> http://blackdragsview.blogspot.com/
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to