Method references in annotations?

Jason Schroeder shrode at subnature.com
Tue Aug 9 09:04:25 PDT 2011


Thanks for the pointers.  The landscape is clearer and
past email threads are clearer.

Once functions can be treated as some fashion of a literal,
some functional language behavior is immediate.

To me, the trouble is that those behaviors should be accidents
instead of goals to keep temptation away.

Question #1.
Has the following been considered previously?

SAM sammy = ...
Method sammyMethod = Method.convertToMethod(SAM.class, sammy);
assertEquals(sammy.method(),sammyMethod.invoke(sammy));

Question #2.
It seems the above code pattern could be sugared thusly:

Method sammyRef = #Person.getLastName

Treating Method as a SAM, Method.invoke, in order to implement
a "method of" feature.

Has that been considered previously?  What was the discussion?

Question #3.
The expectations around the use of lambda.this seem, at first blush,
following the usage of constructor-call this, treating "this" as an
obvious, but unnamed, function call.

I believe the above questions are trying to generalize the feature
to Method.invoke.

Has this been noted previously?

I will leave my questions here for now,
Jason


More information about the lambda-dev mailing list