On 28.03.20 04:06, Daniel.Sun wrote:
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 ->
}
```
[...]
How about unifying the other way around and make 1 and 2 both a method
call with a closure for meth?
bye Jochen