You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2019/02/17 12:12:00 UTC
[jira] [Created] (GROOVY-8997) Add DGM `then` to transform nested
method calls to method call chain
Daniel Sun created GROOVY-8997:
----------------------------------
Summary: Add DGM `then` to transform nested method calls to method call chain
Key: GROOVY-8997
URL: https://issues.apache.org/jira/browse/GROOVY-8997
Project: Groovy
Issue Type: Improvement
Reporter: Daniel Sun
Here is a sample to transform nested method calls to method call chain:
{code:java}
// nested method calls
c(
b(
3,
a()
),
2
)
{code}
{code:java}
// method call chain
a().then {
b(3, it)
}. then {
c(it, 2)
}
{code}
BTW, I even want to introduce a new syntax, which was discussed in dev mailing list:
{code:java}
// the following code is equal to the above code
a() |> b(3, _) |> c(_, 2) // _ represents the former method call result, and |> is like a big arrow
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)