groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <>
Subject Re: .with() variant that returns the original object
Date Thu, 10 Nov 2016 05:04:25 GMT
On Thu, Nov 10, 2016 at 6:45 AM, Jordan Martinez
<> wrote:
> What about `object.itselfWith(Closure)`? Then its understood as returning
> the object itself but with the changes that follow.

Both variants use 'itself' but only one returns 'itself', so I would
regard that prefix as not distinguishing enough. You'd need something
like 'withThen' or 'withReturning' to help distinguish between the
two. The problem with 'withReturning' is that it is longer
(character-wise) than 'with(true)' or just adding 'return it' or 'it'
to the end of the closure - not that numbers of characters alone
should be the most important metric.

Cheers, Paul.

View raw message