Am 12.01.2018 um 18:54 schrieb Russel Winder:
On Fri, 2018-01-12 at 05:54 -0700, Daniel.Sun wrote:
[…]
As you see, the latest implementation is to generate method for lambda
at the class generation stage, in addition new inner classes will be
generated for each lambda.
[…]
I haven't read the code, I am reacting to the above paragraph a bit out of
context. Nonetheless…
The whole point of Java lambdas and use of invokedynamic is to avoid any
classes at all, so the mention of using an inner class worries me. The
anonymous inner class route was tried and rejected in favour of runtime code
generation triggered via an ignoredynamic – I do not know the full details,
hopefully I am not wrong.
ignoredynamic... lol... It is especially funny for me because the
invokedynamic logic does allow you to be more dynamic in your method
selection and callsite logic in general, but it first and foremost uses
static information for this. You have to apply a small trick to get a
real dynamic call out of this. Means I find ignoredynamic quite fitting
actually.
The point here is for me, Groovy should use the same strategy as Java for what
is a Java feature.
It does not have to be 100% the same as Java. Not the same limitations.
But we should be careful if it means bad things for the performance, it
is a prize we have to decide about if we want to pay it.
bye Jochen