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/18 01:42:00 UTC

[jira] [Resolved] (GROOVY-8997) Add DGM `then` to transform nested method calls to method call chain

     [ https://issues.apache.org/jira/browse/GROOVY-8997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Sun resolved GROOVY-8997.
--------------------------------
    Resolution: Won't Fix

We can use {{with}} instead

> 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
>            Assignee: Daniel Sun
>            Priority: Major
>
> 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( http://groovy.329449.n5.nabble.com/GEP-Concatenative-Method-Calls-tt5747708.html ):
> {code:java}
> // the following code is equal to the above code
> // _ represents the former method call result, and |> is like a big arrow representing the direction of data flow
> a()  |>  b(3, _)  |>  c(_, 2)  
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)