groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Sun <realblue...@hotmail.com>
Subject [GEP] About supporting Java-Like array literal
Date Mon, 16 Apr 2018 09:00:19 GMT
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

Mime
View raw message