Hi all, Current groovy grammar of method call contains the following ambiguities, which are odd for users. For example,
1) method call with closure argument. That means the closure on the next line could be treated as argument of method `meth` ``` meth { p -> } ``` 2) binary expression and closure expression. That means the closure is not an argument. ``` a | meth { p -> } ``` I propose to unify the grammar of closure arguments: when closure follows method name directly, it is an argument, otherwise it is just standalone closure. For example, 3) method call with closure argument ``` meth { p -> } ``` 4) variable and closure ``` meth { p -> } ``` Luckily, groovy-parser project containing source code of some famous groovy projects, none of which are broken because of the proposed change[1]. Here is a JIRA ticket[2] to track the proposed change, and here is the PR[3] to implement the change. Any thoughts? Cheers, Daniel Sun [1] https://github.com/danielsun1106/groovy-parser/commits/GROOVY-9484 [2] https://issues.apache.org/jira/browse/GROOVY-9484 [3] https://github.com/apache/groovy/pull/1211 ----- Apache Groovy committer & PMC member Blog: http://blog.sunlan.me Twitter: @daniel_sun -- Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html