Hi all,

       The new parser Parrot has supported some code like `int[] a = new
int[] {1, 2, 3}`. In order to make Groovy compatible with Java better(copy &
paste code and run well), I propose to support Java-Like array literal
further, i.e. supporting some code like`int[] a = {1, 2, 3}`.  I
experimented the new feature last weekend, it works well on the `phoenix`
branch of `danielsun1106/groovy-parser` project[1].

       As for some ambiguous scenario, e.g. `def a = { 1 }`, it is still
parsed as closure, but if the array type is specified `int[] a = { 1 }`, it
will be parsed as int array.

       Any thoughts?

Cheers,
Daniel.Sun
[1] https://github.com/danielsun1106/groovy-parser/tree/phoenix




--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Reply via email to