Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3FA14200C04 for ; Tue, 24 Jan 2017 10:55:13 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3E283160B4B; Tue, 24 Jan 2017 09:55:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 39B0E160B3D for ; Tue, 24 Jan 2017 10:55:12 +0100 (CET) Received: (qmail 47552 invoked by uid 500); 24 Jan 2017 09:55:11 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 47540 invoked by uid 99); 24 Jan 2017 09:55:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2017 09:55:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B3297C1FD6 for ; Tue, 24 Jan 2017 09:55:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.115 X-Spam-Level: **** X-Spam-Status: No, score=4.115 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_SPAM=0.5, URIBL_BLOCKED=0.001, URI_HEX=1.313] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id isCJXAEnRaBo for ; Tue, 24 Jan 2017 09:55:08 +0000 (UTC) Received: from smtpout01.partage.renater.fr (smtpout01.partage.renater.fr [194.254.240.31]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id C5D875F47F for ; Tue, 24 Jan 2017 09:55:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtpout01.partage.renater.fr (Postfix) with ESMTP id 5D6BDA7A04; Tue, 24 Jan 2017 10:54:58 +0100 (CET) Received: from smtpout01.partage.renater.fr ([127.0.0.1]) by localhost (smtpout01.partage.renater.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 91OX7Jnj4I0r; Tue, 24 Jan 2017 10:54:54 +0100 (CET) Received: from zmtaout02.partage.renater.fr (zmtaout02.partage.renater.fr [194.254.241.30]) by smtpout01.partage.renater.fr (Postfix) with ESMTP id 79FD8A72BB; Tue, 24 Jan 2017 10:54:51 +0100 (CET) Received: from zmtaout02.partage.renater.fr (localhost [127.0.0.1]) by zmtaout02.partage.renater.fr (Postfix) with ESMTPS id 65ED920081; Tue, 24 Jan 2017 10:54:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zmtaout02.partage.renater.fr (Postfix) with ESMTP id 54CE72008A; Tue, 24 Jan 2017 10:54:51 +0100 (CET) X-Virus-Scanned: amavisd-new at zmtaout02.partage.renater.fr Received: from zmtaout02.partage.renater.fr ([127.0.0.1]) by localhost (zmtaout02.partage.renater.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id iUfgmjCG35Dr; Tue, 24 Jan 2017 10:54:51 +0100 (CET) Received: from zstore27-staff.partage.renater.fr (zstore27-staff.partage.renater.fr [10.254.241.53]) by zmtaout02.partage.renater.fr (Postfix) with ESMTP id 374CD20081; Tue, 24 Jan 2017 10:54:51 +0100 (CET) Date: Tue, 24 Jan 2017 10:54:51 +0100 (CET) From: Remi Forax To: dev@groovy.apache.org Cc: dev@groovy.incubator.apache.org Message-ID: <1972781077.583597.1485251691072.JavaMail.zimbra@u-pem.fr> In-Reply-To: References: <1485242090452-5737941.post@n5.nabble.com> <1485247922211-5737944.post@n5.nabble.com> Subject: Re: About array initializer of Java style for Groovy 3 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_583596_680360593.1485251691071" X-Originating-IP: [194.254.242.1] X-Mailer: Zimbra 8.6.0_GA_1200 (ZimbraWebClient - FF50 (Linux)/8.6.0_GA_1200) Thread-Topic: About array initializer of Java style for Groovy 3 Thread-Index: f1pYonWaIMgd2KuXg1Ryn1UVOX134w== archived-at: Tue, 24 Jan 2017 09:55:13 -0000 ------=_Part_583596_680360593.1485251691071 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Also note that in Java=20 Integer[] o =3D { 3 }; and int[] o =3D { 3 };=20 both work but=20 Object o =3D { 3 };=20 does not compile because the syntax '{' '}' with no explicit array type do = inference (and here Object is not an array so the inference fails).=20 Supporting only explicit array initialization seems to be the right choice = !=20 R=C3=A9mi=20 > De: "Daniel Sun" > =C3=80: dev@groovy.incubator.apache.org > Envoy=C3=A9: Mardi 24 Janvier 2017 10:42:03 > Objet: Re: About array initializer of Java style for Groovy 3 > +1 > =E5=9C=A8 "Guillaume Laforge [via Groovy]" =EF= =BC=8C2017=E5=B9=B41=E6=9C=8824=E6=97=A5 > =E4=B8=8B=E5=8D=885:19=E5=86=99=E9=81=93=EF=BC=9A >> Good point. >> We should definitely avoid confusion as much as possible, and avoid intr= oducing >> ambiguities. >> On Tue, Jan 24, 2017 at 10:12 AM, Andres Almiray < [hidden email] > wrot= e: >>> I think we should support only explicit array initilization with array = type, >>> that is "new int[] { 2 }" for compatibility's sake. >>> Sent from my iPhone >>> On 24 Jan 2017, at 09:59, Daniel Sun < [hidden email] > wrote: >>>> or we just support new int[] {1,2,3} =EF=BC=9F >>>> =E5=9C=A8 "Guillaume Laforge [via Groovy]" = =EF=BC=8C2017=E5=B9=B41=E6=9C=8824=E6=97=A5 >>>> 16:54=E5=86=99=E9=81=93=EF=BC=9A >>>>> What happens for def a =3D { 2 }, is it parsed as a closure or an arr= ay >>>>> initializer? >>>>> On Tue, Jan 24, 2017 at 9:52 AM, Daniel Sun < [hidden email] > wrote: >>>>>> Hi Andres, >>>>>> Parrot can parse ` def a =3D {1, 2, 3}` properly, but it can not par= se >>>>>> `{1, 2, 3}`, which is not supported by Java too. >>>>>> This is the initial implementation :) >>>>>> https://github.com/danielsun1106/groovy-parser/commit/96e6c923a4d09d= 48448f8731a314c918ee6c0e7c >>>>>> Cheers, >>>>>> Daniel.Sun >>>>>> -- >>>>>> View this message in context: >>>>>> http://groovy.329449.n5.nabble.com/About-array-initializer-of-Java-s= tyle-for-Groovy-3-tp5737941p5737944.html >>>>>> Sent from the Groovy Dev mailing list archive at Nabble.com . >>>>> -- >>>>> Guillaume Laforge >>>>> Apache Groovy committer & PMC Vice-President >>>>> Developer Advocate @ Google Cloud Platform >>>>> Blog: http://glaforge.appspot.com/ >>>>> Social: @glaforge / Google+ >>>>> If you reply to this email, your message will be added to the discuss= ion below: >>>>> http://groovy.329449.n5.nabble.com/About-array-initializer-of-Java-st= yle-for-Groovy-3-tp5737941p5737945.html >>>>> To unsubscribe from About array initializer of Java style for Groovy = 3, click >>>>> here . >>>>> NAML >>>> View this message in context: Re: About array initializer of Java styl= e for >>>> Groovy 3 >>>> Sent from the Groovy Dev mailing list archive at Nabble.com . >> -- >> Guillaume Laforge >> Apache Groovy committer & PMC Vice-President >> Developer Advocate @ Google Cloud Platform >> Blog: http://glaforge.appspot.com/ >> Social: @glaforge / Google+ >> If you reply to this email, your message will be added to the discussion= below: >> http://groovy.329449.n5.nabble.com/About-array-initializer-of-Java-style= -for-Groovy-3-tp5737941p5737949.html >> To unsubscribe from About array initializer of Java style for Groovy 3, = click >> here . >> NAML > View this message in context: Re: About array initializer of Java style f= or > Groovy 3 > Sent from the Groovy Dev mailing list archive at Nabble.com. ------=_Part_583596_680360593.1485251691071 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Also note that in Java
&= nbsp; Integer[] o =3D  { 3 }; and int[] o =3D  { 3 };
both work but
  Object o =3D  { 3 };
does not compile because the syntax '{' '}' w= ith 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 !

R=C3=A9mi

De: "Dan= iel Sun" <realbluesun@hotmail.com>
=C3=80: dev@groovy.incub= ator.apache.org
Envoy=C3=A9: Mardi 24 Janvier 2017 10:42:03
Objet: Re: About array initializer of Java style for Groovy 3
+1



=E5=9C=A8 "Guillaume Laforge [via Groovy]" <m= l-node+[hidden email]>=EF=BC=8C201= 7=E5=B9=B41=E6=9C=8824=E6=97=A5 =E4=B8=8B=E5=8D=885:19=E5=86=99=E9=81=93=EF= =BC=9A

Good point.
We should definitely avoid confusion as much as possible, and avoid in= troducing ambiguities.

On Tue, Jan 24, 2017 at 10:12 AM, Andres Almiray= <[hidden email]>= ; wrote:
I think we should support only explicit array initilization with array= type, that is "new int[] { 2 }" for compatibility's sake. 

Sent from my iPhone

On 24 Jan 2017, at 09:59, Daniel Sun <[hidden email]> wrote:

or we just support new int[] {1,2,3}  =EF=BC=9F



=E5=9C=A8 "Guillaume Laforg= e [via Groovy]" <ml-node+[hidden email]>=EF=BC=8C2017=E5=B9=B41=E6=9C=8824=E6=97=A5 16:54= =E5=86=99=E9=81=93=EF=BC=9A

What happens for def a =3D { 2 }, is it parsed as a closur= e or an array initializer?

On Tue, Jan 24, 2017 at 9:52 AM, Daniel Sun <[hidden email]> wrote= :
Hi Andres,

       Parrot can parse ` def a =3D {1, 2, 3}` properly= , but it can not parse
`{1, 2, 3}`, which is not supported by Java too.

       This is the initial implementation :)
https://= github.com/danielsun1106/groovy-parser/commit/96e6c923a4d09d48448f8731a314c= 918ee6c0e7c


Cheers,
Daniel.Sun




--
View this message in context: http://groovy.329449.n5.nabble.com/About-array-initializer-of-Java-style-fo= r-Groovy-3-tp5737941p5737944.html
Sent from the Groovy Dev mailing lis= t archive at Nabble.com= .



--
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform




If you reply to this email, your message wi= ll be added to the discussion below:
http://groovy.329449.n5.nabble.com/About-array-initializer-of-Java-st= yle-for-Groovy-3-tp5737941p5737945.html
To unsubscribe from About array initializer of Java style for Groovy 3, click here.
NAML


View this message in context: Re: About array initializer of Java style for Groovy 3
Sent from the Groovy Dev mailing list archive at Nabble.com.



--
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform




If you reply to this email, your message wi= ll be added to the discussion below:
http://groovy.329449.n5.nabble.com/About-array-initializer-of-Java-st= yle-for-Groovy-3-tp5737941p5737949.html
To unsubscribe from About array initializer of Java style for Groovy 3, click here.
NAML
=09 =09 =09

View this message in context: Re: About array initializer of Java style for Groovy 3
Sent from the
Groovy Dev mailing list archive at Nabble.c= om.
------=_Part_583596_680360593.1485251691071--