Right invokedynamic doesn't just "mostly benefit object-oriented languages." 
A MethodHandle can be used for anything that the JVM can do from a static 
method call, to an instance method call, to a constructor, to a field 
access.

And in fact the bootstrap method that links an invokedynamic call site does 
not have to dispatch on the type of the first argument in an object oriented 
way, it can actually do completely generic dispatch akin to Clojure's 
multimethods.

You can take a MethodHandle and curry the method by supplying some of the 
arguments, and this nice little packaged MethodHandle is given to the JVM 
with complete transparency for it to do it's stuff.

You can create collector and spreader methods to do things like RestFn does 
where it takes rest args. You could probably even do destructuring of 
arguments in a chain of MethodHandles that the JVM then could understand and 
optimize.

Maybe not all that potential is fully delivered with the current release of 
Java 7, but I think the transparency that invokedynamic allows should make 
it much easier for the JVM to do better optimizations.


Paul

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to