Request for comments: Methods as properties on POJOs, composite MOP operations, oh my

49 views
Skip to first unread message

Attila Szegedi

unread,
Jul 26, 2012, 8:42:19 PM7/26/12
to jvm-la...@googlegroups.com
Greetings from a small Santa Clara Oracle corner office whose surroundings are currently Swede-infested.

So, having cleared Dynalink 0.3 out of the way, I'm working on the next version.

I'm rattling an idea the last few days about adding a new MOP operation to Dynalink, "dyn:call", which'd allow calling of objects that languages recognize as first-class functions. Typical candidates are method handles, things implementing Callable etc. I started thinking of how to expose Java methods of POJOs as something that can be "dyn:call"-ed, and ended up with several different possibilities (the easiest one, but probably the not entirely optimal one is treating them as simple properties) as well as some interesting longer-term ideas such as composite MOP operations. 

The writeup is here, and I'd appreciate feedback, either on the Wiki page itself or here in the e-mail thread:


Thanks,
  Attila.

Rémi Forax

unread,
Jul 27, 2012, 1:28:59 PM7/27/12
to jvm-la...@googlegroups.com
I'm not sure this is different from an object creation, it's a kind of
reification of a function/method,
so an object creation.
Now given that for some languages, System.out.println can be a constant,
the creation has to be done by an invokedynamic,
(in a lazy way by example) so must be a call of the meta object protocol.

Also, the default implementation should be able to do exactly what the
jdk8 will do for lambda, exactly for method reference, i.e transforms a
reference to a method (or a reference to a method + a receiver object)
to see them as on object implementing a SAM interface.
Note that if dynalink run on jdk8, it can directly calls the lambda
metafactory (the code used by java the language).

> Thanks,
> Attila.

cheers,
R�mi

Reply all
Reply to author
Forward
0 new messages