groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: About array initializer of Java style for Groovy 3
Date Tue, 24 Jan 2017 13:58:42 GMT


On 24.01.2017 10:54, Remi Forax wrote:
> Also note that in Java
>   Integer[] o =  { 3 }; and int[] o =  { 3 };
> both work but
>   Object o =  { 3 };
> does not compile because the syntax '{' '}' with no explicit array type
> do inference (and here Object is not an array so the inference fails).
>
> Supporting only explicit array initialization seems to be the right choice !

do if I understand this right parrot will now (after another great 
change from Daniel Sun) not support Integer[] o =  { 3 }.

But I think we could support the cases described here. Only thing we 
have to do is if the declaring side uses an array type. So I would parse 
Integer[] o =  { 3 } as a declaration with the right side being a 
closure expression and then transform it to an array init... or fail if 
the left side is no array type.

bye Jochen

Mime
View raw message