On Apr 17, 2008, at 1:26 AM, Martin Probst wrote:

> I think while your at it defining a way to obtain a handle to a
> method, maybe it would be nice to introduce something like a Smalltalk
> symbol to Java? I'd like to be able to write "@Index(on = &Foo.bar)",
> or something similar.

Yes, that notation would be nice in several places.  For annotations,  
I think you want something a little different from method handles,  
since &Foo.bar above is a symbolic reference, rather than an opaque  
method.

I left out several such things in the "nutshell" note for two reasons.

1. It is a language-oriented feature, not a JVM-oriented one.

2. It is not the core of the proposal, but rather a detail to fill in.

Consider Neal's recent admission of such a construct to closures.   
It's a common thing to ask for (I asked for it 2 years ago http:// 
blogs.sun.com/jrose/entry/better_closures ).  But it is best to  
concentrate on the core features first and then fill out the boundary  
of the design as necessary.

In that spirit, and for the JVM, I am thinking that "ldc" of  
a*Methodref  constant pool entry should yield a method handle.

Also, maybe we should slightly temper the opaqueness of method  
handles, and allow a "MethodHandles.reflect" operation which will  
recover the full java.lang.reflect.Method, in all its symbolic  
glory.  I don't think that causes a security problem, and it makes  
some uses of method handles (e.g., debugging them) smoother.   
Basically, I've left open the question of how the Core Reflection API  
interoperates with method handles, but full reflection is obviously  
the most plausible option.  (Yes, it goes against the grain of what  
function objects do, but reflection is an equal-opportunity offender  
in that respect:  It also threatens object abstraction boundaries.)

-- John

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com
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