2016-10-19 10:51 GMT+02:00 Jochen Theodorou <blackd...@gmx.org>: > > > On 19.10.2016 09:09, Cédric Champeau wrote: > >> First of all, great work, Daniel ! I'm confident that making the >> "lambdas" be "closures" in Groovy is enough. >> > > I think it won't be enough for :: and MethodClosures. Actually, Daniel, > are those supported in the new Grammar and what are they mapped to?
That's correct. I would really love to have _real_ method mapping for :: in the static compiler. This is obviously not possible for the dynamic runtime. One option, if we want to make it possible to optimize from the static compiler is to have a new AST node, MethodPointer, that would be interpreted as a MethodClosure, and potentially optimized by the static compiler later as a method pointer. > > > I stated it in the past but >> I'm going to repeat myself here, I don't think having 2 syntax for >> "closures/lambdas" with slightly different semantics would help our >> users/language. >> > > They should have the semantics of Closure, then it is probably good. > > That said, the static compiler can do better, doing >> escape analysis, and using "real" lambdas when the target bytecode is 8, >> as an optimization. >> > > In Groovy 3 I do plan to make out Closures behave similar to lambdas. Of > course with the additional problem of Closure not being a functional > interface... well... let's not get started on MOP2 here ;) > > bye Jochen >