Hi all, Jesper and I discussed the *real* lambda expression(i.e. Java8's lambda expression) just now. As Jesper found, Java8's lambda expression is implemented in Java as an invokedynamic call which makes use of a bootstrap method calling into a class called the LambdaMetafactory (https://docs.oracle.com/javase/8/docs/api/java/lang/invoke/LambdaMetafactory.html). and puts the body of the lambda expression into a hidden method on the class. The LambdaMetafactory sets up the magic class which holds any escaped variables and implements the functional interface. To work, it requires EXACT type information,* so it's only possible to do this in static compilation*.
Current lambda expression is based on closure, so it can work well in the default mode and static compilation mode. But if we want the *real* lambda expression, it will be only available in the static compilation mode(as above said). When developers does not enable static compilation, we provide them lambda expression based on closure or provide no lambda expression at all? I prefer the universal version of lambda expression, i.e. lambda expression based on closure with some warning(such as changing the delegation strategy of 'this' is forbidden, reference: http://groovy-lang.org/closures.html#_delegation_strategy) - [ ] A, lambda expression based on closure with warning(or error prompt) - [ ] B, *real* lambda expression is available *in the static compilation mode* while lambda expression based on closure is available *in the default mode* - [ ] C, *real* lambda expression is only available *in the static compilation mode* while *no lambda expression* is available *in the default mode* P.S. My vote is A Cheers, Daniel.Sun -- View this message in context: http://groovy.329449.n5.nabble.com/VOTE-About-the-implementation-of-lambda-expression-tp5738486.html Sent from the Groovy Dev mailing list archive at Nabble.com.