groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Sun (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-8997) Add DGM `then` to transform nested method calls to method call chain
Date Sun, 17 Feb 2019 12:12:00 GMT
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)

Mime
View raw message