Re: Automatic closure coercion and delegate

2016-05-02 Thread Jochen Theodorou
On 02.05.2016 16:44, Cédric Champeau wrote: [...] Of course, it may look a bit superficial but it is super important for nice DSLs like in Gradle. could you give an example of a more complex closure usage? We should be also aware that this change may break code, since it is semantic change

Re: Automatic closure coercion and delegate

2016-05-02 Thread Guillaume Laforge
On Mon, May 2, 2016 at 5:25 PM, Joe Wolf wrote: > [...] > > [Hi, all. This is my first post to the list--been a happy Groovy user > since version 1.5] > Welcome here and thanks for using Groovy since 1.5!!! :-) Guillaume > > -Joe > > > On Mon, May 2, 2016 at 10:56 AM,

Re: Automatic closure coercion and delegate

2016-05-02 Thread Joe Wolf
+1 Would it be sensible/possible to add a Closure.FIRST_ARGUMENT resolve strategy and include it in the default resolution chain? The 'it'-less closure would behave as expected even without pre-assigning the delegate (provided that length() was not defined by the delegate/owner). It'd still

Automatic closure coercion and delegate

2016-05-02 Thread Cédric Champeau
Hi guys, I've been grumpy about this for a bit too long to keep it for myself, so let me explain the issue :) Imagine you have a Java method that accepts a SAM type: interface Action { void execute(T object) } class Person { String name } void configure(Action config) {