+1 for withThis or withValue and +10 for Jochen's overloading proposal
if it's feasible.
-1000 for tap. Completely nonsensical to me and makes me think of
network tun/tap interfaces in Linux or something like that. Isn't the
functionality a little bit like the Builder pattern more than a pipeline
of commands? Maybe I'm misunderstanding the whole thing. Either way, to
introduce a completely new name for something that is already named and
simply augmented in terms of functionality seems very confusing and
counter intuitive to me. Imagine a Groovy newbie that reads a tutorial
or reference manual and first learns about with(). Then a little further
on, tap() is introduced. I would immediately think "why on earth did
they name these things completely differently, when one is essentially a
variant of the other???". Again, forgive me if I'm completely
misunderstanding the context here.
-Henrik
On 11/8/16 10:16 AM, Gerald Wiltse wrote:
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
[email protected] <mailto:[email protected]>
On Tue, Nov 8, 2016 at 12:43 PM, Marc Paquette <[email protected]
<mailto:[email protected]>> 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 <[email protected]
<mailto:[email protected]>> a écrit :
On Nov 8, 2016, at 11:41 AM, Jochen Theodorou <[email protected]
<mailto:[email protected]>> 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