« Return to Thread: Groovy syntax /API enhancement

Re: Groovy syntax /API enhancement

by glaforge :: Rate this Message:

Reply to Author | View in Thread

On Mon, Apr 21, 2008 at 3:32 PM, Tom Nichols <tmnichols@...> wrote:
> [...]
>  >  I am against all these withIndex methods... they are polluting the API so
>  > much. I would like to have a more general solution, but I can't think of any
>  > yet
>
>  Can't you just modify the each/any/collect methods to test how many
>  parameters the closure takes?  If the closure only takes one param
>  assume it is the item.  If it takes two params, assume (item, index).
>  No?

That's what we're already doing for some of the methods like each().
But it'd be nice to expand this approach to all methods for which it may apply.

--
Guillaume Laforge
Groovy Project Manager
G2One, Inc. Vice-President Technology
http://www.g2one.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Groovy syntax /API enhancement