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 7CE7A200BBD for ; Tue, 8 Nov 2016 17:32:17 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7B61C160B0A; Tue, 8 Nov 2016 16:32:17 +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 C0E68160AD0 for ; Tue, 8 Nov 2016 17:32:16 +0100 (CET) Received: (qmail 80974 invoked by uid 500); 8 Nov 2016 16:32:10 -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 80694 invoked by uid 99); 8 Nov 2016 16:32:10 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Nov 2016 16:32:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 13B06183994 for ; Tue, 8 Nov 2016 16:32:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.613 X-Spam-Level: * X-Spam-Status: No, score=1.613 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, URIBL_BLOCKED=0.001, URI_HEX=1.313] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id qtsGEU45dbcJ for ; Tue, 8 Nov 2016 16:32:09 +0000 (UTC) Received: from smtp.czechia.com (smtp1.czechia.com [217.198.120.39]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id F155D5FC2B for ; Tue, 8 Nov 2016 16:32:08 +0000 (UTC) Received: from [10.0.0.1] (31.4.broadband2.iol.cz [83.208.4.31]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: ocs@ocs.cz) by smtp.czechia.com (Postfix) with ESMTPSA id 0B84B202871C2; Tue, 8 Nov 2016 17:31:58 +0100 (CET) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Safe index for Groovy 3 From: "ocs@ocs.cz" In-Reply-To: <1478621298812-5736558.post@n5.nabble.com> Date: Tue, 8 Nov 2016 17:31:58 +0100 Cc: dev@groovy.incubator.apache.org Content-Transfer-Encoding: quoted-printable Message-Id: <8F0E7347-05E3-48A1-A4D4-8E4873305C11@ocs.cz> References: <1478621298812-5736558.post@n5.nabble.com> To: dev@groovy.apache.org, Daniel Sun X-Mailer: Apple Mail (2.3124) archived-at: Tue, 08 Nov 2016 16:32:17 -0000 Hi there, > Any thoughts? Does it support properly "foo[null]", too? That aside, I would just again like to advocate for an, let's say, = =E2=80=9Efull-safe=E2=80=9C mode, where one could set some switch = (probably would need to be a compile-time one I guess) to get implicitly = the =E2=80=9Esafe mode=E2=80=9C for _all_ expressions (methods, indexes, = operators -- have I forgot anything?) without a need to write all those = pesky ?'s explicitly. Thanks and all the best, OC > On 8. 11. 2016, at 5:08 PM, Daniel Sun = wrote: >=20 > Hi all, >=20 > The new parser supports safe index now, which is proposed by Paul = King > :) >=20 > Here are some example code: >=20 > assert null =3D=3D null?[1]; > assert null =3D=3D null?[1]?[1, 2]; > assert null =3D=3D null?[1]?[1, 2]?[1, 2, 3]; >=20 > def a =3D null; > assert null =3D=3D a?[1, 2]; >=20 > def f() {return null} > assert null =3D=3D f()?[1]; >=20 > More information can be found at the safeIndex branch of > groovy-parser > project(https://github.com/danielsun1106/groovy-parser/tree/safeIndex) >=20 > Any thoughts? >=20 > BTW, the antlr4 branch of apache/groovy is very old, I am going = to > try to update it with the master. >=20 > Cheers, > Daniel.Sun >=20 >=20 >=20 >=20 >=20 > -- > View this message in context: = http://groovy.329449.n5.nabble.com/Safe-index-for-Groovy-3-tp5736558.html > Sent from the Groovy Dev mailing list archive at Nabble.com.