groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerald Wiltse <jerrywil...@gmail.com>
Subject Re: .with() variant that returns the original object
Date Tue, 08 Nov 2016 18:16:07 GMT
Some really neat and creative suggestions here suddenly. Still happy with
any name, but I do like "withThis"  and "having",  However, tap seems to be
gaining momentum and with good reasons, despite the common complaint of
"What the heck does tap mean".  I agree it makes more sense after
explained.

Gerald R. Wiltse
jerrywiltse@gmail.com


On Tue, Nov 8, 2016 at 12:43 PM, Marc Paquette <marcpa@mac.com> wrote:

> +1 for tap.  Concise and makes sense once explained (even intuitive to
> some).
>
> Have you ever tried to find usages of with in groovy with code examples
> with google without eventually loosing your temper ?
>
> For one thing, I think tap will be easier to google for.
>
> Marc Paquette
>
> Le 8 nov. 2016 à 12:32, Suderman Keith <suderman@anc.org> a écrit :
>
>
> On Nov 8, 2016, at 11:41 AM, Jochen Theodorou <blackdrag@gmx.org> wrote:
>
> what about an overloaded with:
>
>
> +1
>
> Or even something like:
>
> myObject.with { ... } // current behaviour
> myObject.with(return:this) { ... } // returns this when finished.
> myObejct.with(return:new Object()) { ... } // returns a new Object when
> finished.
>
> This particular syntax would take a bit of extra parser arm waving since
> the `return` keyword is being used differently in this context.
>
> Keith
>
>
> myObject.with(true) {
>   // some code
> }
>
>
> or:
>
> myObject.with(returnThis:true) {
>   // some code
> }
>
>
> or... well I am sure there are many variants... just want to know if
> something like this doesn't cut it.
>
> bye Jochen
>
>
>
>

Mime
View raw message