Return-Path: X-Original-To: apmail-groovy-dev-archive@minotaur.apache.org Delivered-To: apmail-groovy-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5DB0719193 for ; Mon, 7 Mar 2016 11:29:21 +0000 (UTC) Received: (qmail 1965 invoked by uid 500); 7 Mar 2016 11:29:21 -0000 Delivered-To: apmail-groovy-dev-archive@groovy.apache.org Received: (qmail 1927 invoked by uid 500); 7 Mar 2016 11:29:21 -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 1917 invoked by uid 99); 7 Mar 2016 11:29:21 -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; Mon, 07 Mar 2016 11:29:21 +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 8FEB2C1B95 for ; Mon, 7 Mar 2016 11:29:20 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.28 X-Spam-Level: * X-Spam-Status: No, score=1.28 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=selskabet-org.20150623.gappssmtp.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Cuzg5vAzUIXZ for ; Mon, 7 Mar 2016 11:29:19 +0000 (UTC) Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id B7B035FAE4 for ; Mon, 7 Mar 2016 11:29:18 +0000 (UTC) Received: by mail-wm0-f45.google.com with SMTP id p65so103995380wmp.1 for ; Mon, 07 Mar 2016 03:29:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=selskabet-org.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:references:to:in-reply-to; bh=VEiQfrv9FzqopEFRcFaFXUxSjdyimKxi+O8aqUucCGI=; b=rk08R/DiZ2R7TBYa2KaO2m9raqT//Pqqu7h2f9pnQm5QIfMM3HGE7TTXkP4/Bvk7Pa CLRAvtc1NvUxOL/92xnw9Sf1pGyrKat8hcelYoWggHh2Wx0y9T+DREoCsoqkecms38Et 8Wf3J4tKqZhq43+PRRqEMBOLaAVKD60mlcqAPZO9bZB2EcijpcoxXuA6o6wTzH2k1iP1 LZrMgfTrqW4fjDgUjx9O3qJdgLqHcjTodpGtLD7vqfCTxLQplLZQ8AUHbs0Lm7VNZARM G/UWPzx9QYAgrQZPFFlYtHBo9A14wYuPFY1gRpoJC3rFOStlEe1fBqdi9xKu7er5ji/E jdNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:mime-version:subject:date :references:to:in-reply-to; bh=VEiQfrv9FzqopEFRcFaFXUxSjdyimKxi+O8aqUucCGI=; b=X7tltKxahp00OcOlh1lIILsOij6RWO9qvHT5d57hnFaXLOOy4i1hDbSpXcDoczNHdX p1YhuJ00g7fl6S2JS116560kK3y3i+wAH+sGByrxJsuKEjP1gnlGDRClj0lpwVf5exk0 vl0bmB9A7jnK1WoDepYES+SLpdCIEYMarPj7OhGFD791rt4IeC091nXtmIzdx/4GXfCR TBcAzkM14WsM+LAPU0x7d0nWFdP8UMk0jesYbEfSRto8r0tDoyyROKmaEHmDnv+LeNXP x2smNSDirrNdDHhWB9CTLKoW2mDRXDQD0Ud12P8DgPsM8jgwiVlEljpljpK9/eE5c5jb hY7g== X-Gm-Message-State: AD7BkJIu6tB/RBSO/wXr1icfMvw30vApmHZmc/6+cZYJE7CdLBH0EXtxEcz1kbd9Dj+i+A== X-Received: by 10.28.215.16 with SMTP id o16mr11969765wmg.57.1457350157514; Mon, 07 Mar 2016 03:29:17 -0800 (PST) Received: from desktop-2fllgrr.es.lan ([37.49.142.33]) by smtp.gmail.com with ESMTPSA id o128sm13119546wmb.19.2016.03.07.03.29.16 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Mar 2016 03:29:16 -0800 (PST) From: =?utf-8?Q?Jesper_Steen_M=C3=B8ller?= Content-Type: multipart/alternative; boundary="Apple-Mail=_06137C22-D317-4FFD-B55C-4F31F1AFBABE" Message-Id: <4704F416-146D-4659-8466-3ED0FF61530F@selskabet.org> Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: Progress on the Antlr4-based parser Date: Mon, 7 Mar 2016 12:29:15 +0100 References: <17CA5130-83B2-4B82-84E5-BAE8BB4CB4EE@selskabet.org> <56DD43AC.4080507@gmx.org> To: dev@groovy.apache.org In-Reply-To: <56DD43AC.4080507@gmx.org> X-Mailer: Apple Mail (2.3112) --Apple-Mail=_06137C22-D317-4FFD-B55C-4F31F1AFBABE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Blackdrag On 7. mar. 2016, at 10.02, Jochen Theodorou wrote: >=20 > On 07.03.2016 07:48, Jesper Steen M=C3=B8ller wrote: > [...] >>=20 >> So you can help me with a couple of answers: >>=20 >> * Is it a goal to close the gap to Java=E2=80=99s more trickier = syntax, such >> as placement-new and placement constructor calls? =46rom what I = can >> tell, we=E2=80=99d have to extend the AST too to support that. Has = anyone >> ever used that except in compiler test cases? >=20 > I had to actually look up what you mean... so you can give type = arguments in a constructor call? I did actually not know this. I would = not give this one any priority, unless it is easy to do=E2=80=A6 but = then I would not really give it an AST implementation yet It=E2=80=99s certainly not something which is used a lot. Yes, you can = declare type parameters for constructors like you can for methods. This = is not supported in Groovy for now - neither is calling one. Actually, placement new and placement constructor calls are different = from explicit type arguments. Placement new is used to specify the =E2=80=98outer=E2=80=99-instance = for inner classes, and . I really dont think anyone does that in = practise - here is an example: public class A { A(String name) { this.me =3D name; } String me; public class B { String who() { return "I'm a B inside " + me; } } public static class C extends B { C(A outer) { outer.super(); // This is =E2=80=9Cplacement = constructor=E2=80=9D, could be fudged in the AST as function call until = late in compilation } String who() { return "I'm a C inheiriting from this guy: " + = super.who(); } } public static void main(String[] args) { A a1 =3D new A("John"); A a2 =3D new A("Paul"); B b =3D a1.new B(); // This is "placement new" - may = require AST for groovy, certainly grammar System.out.println(b.who()); C c =3D new C(a2); System.out.println(c.who()); } } Just what you always needed, right? I only learned about it from working = on the JDT compiler. Also - I=E2=80=99m also -1 on introducing these pretty much useless Java = features =E2=80=94 it=E2=80=99s not =E2=80=9Cgratuitous = incompatibility=E2=80=9D, but major complications without any use. = I=E2=80=99ll keep a list, but stop asking=E2=80=A6 >=20 >> * ./benchmark/bench/heapsort.groovy uses access modfiers on the >> script=E2=80=99s local variables =E2=80=94 that=E2=80=99s not = really allowed, is it? How >> should that work? It can=E2=80=99t get it to work in Groovy 2.4.x >=20 > You mean like "public static final long IM =3D 139968"? It does not = really make a semantic sense to allow this. For convenient copy&paste = this could be allowed... if it poses no problem, I think it would be = nice to have. But it is not really required >=20 But what should it mean? Should it become fields in the Script class, or = just be stripped of access and staticness and introduced as locals in = the main() ? Since it doesn=E2=80=99t work in Groovy now, I don=E2=80=99t understand = why it=E2=80=99s in the repo at all=E2=80=A6 -Jesper --Apple-Mail=_06137C22-D317-4FFD-B55C-4F31F1AFBABE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi Blackdrag

On 7. mar. 2016, at 10.02, Jochen Theodorou <blackdrag@gmx.org> = wrote:

On 07.03.2016 07:48, Jesper = Steen M=C3=B8ller wrote:
[...]

So you can help me with a couple = of answers:

 * Is it a goal to close = the gap to Java=E2=80=99s more trickier syntax, such
=    as placement-new and placement constructor calls? =46rom= what I can
   tell, we=E2=80=99d have to = extend the AST too to support that. Has anyone
=    ever used that except in compiler test cases?

I had to actually look up what = you mean... so you can give type arguments in a constructor call? I did = actually not know this. I would not give this one any priority, unless = it is easy to do=E2=80=A6 but then I would not really give it an AST = implementation yet

It=E2=80=99s certainly not something which is used = a lot. Yes, you can declare type parameters for constructors like you = can for methods. This is not supported in Groovy for now - neither is = calling one.

Actually, placement new = and placement constructor calls are different from explicit type = arguments.
Placement new is used to specify the = =E2=80=98outer=E2=80=99-instance for inner classes, and . I really dont = think anyone does that in practise - here is an example:

public class A {
A(String = name) {
this.me =3D = name;
}
String = me;
= public class B {
= String who() {
return "I'm a B = inside " + me;
}
= }
public static class C extends B = {
= C(A outer) {
outer.super(); // This = is =E2=80=9Cplacement constructor=E2=80=9D, could be = fudged in the AST as function call until late in = compilation
= }
String who() = {
= return "I'm a C inheiriting from this guy: " + = super.who();
}
= }
public static void main(String[] = args) {
A a1 =3D new = A("John");
A a2 =3D new = A("Paul");
B b =3D a1.new B();  = // This is "placement new" - may require AST for groovy, certainly = grammar
= System.out.println(b.who());
C = c =3D new C(a2);
= System.out.println(c.who());
= }
}

Just what you always = needed, right? I only learned about it from working on the JDT = compiler.

Also - I=E2=80=99m also -1 on introducing these = pretty much useless Java features =E2=80=94 it=E2=80=99s not = =E2=80=9Cgratuitous incompatibility=E2=80=9D, but major complications = without any use. I=E2=80=99ll keep a list, but stop asking=E2=80=A6
<= div class=3D"">

 * ./benchmark/bench/heapsort.groovy uses = access modfiers on the
   script=E2=80=99s = local variables =E2=80=94 that=E2=80=99s not really allowed, is it? = How
   should that work? It can=E2=80=99t = get it to work in Groovy 2.4.x

You mean like "public static final long IM =3D 139968"? It = does not really make a semantic sense to allow this. For convenient = copy&paste this could be allowed... if it poses no problem, I think = it would be nice to have. But it is not really required

But what should it mean? Should = it become fields in the Script class, or just be stripped of access and = staticness and introduced as locals in the main() ?

Since it doesn=E2=80=99t work in Groovy now, I = don=E2=80=99t understand why it=E2=80=99s in the repo at = all=E2=80=A6

-Jesper

= --Apple-Mail=_06137C22-D317-4FFD-B55C-4F31F1AFBABE--