GitHub user christoph-frick reopened a pull request:
https://github.com/apache/groovy/pull/174
add `doto`: same as `with`, but returns the incoming object
My usecase for `with` is >80% to (ab)use it as some sort of builder. Since
I end up putting close to always `(return) it` at the end of my closure: `doto`
is a slight variation of `with`, that just returns the incoming object.
[`doto` is a loanword from clojure](http://clojuredocs.org/clojure.core/doto),
where it does the same and I could not find a naming scheme for groovy, that
would not involve renaming `with` (which is impossible).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/christoph-frick/incubator-groovy master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/groovy/pull/174.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #174
----
commit 31cf750e787476e289235b25a8e59ca8a09c8cce
Author: Christoph Frick <[email protected]>
Date: 2015-11-01T21:01:23Z
add `doto`: same as `with`, but returns the incoming object
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---