A few times I've wanted to have safe index.
Sounds like a good idea.

On Tue, Nov 8, 2016 at 5:08 PM, Daniel Sun <realbluesun@hotmail.com> wrote:
Hi all,

      The new parser supports safe index now, which is proposed by Paul King
:)

      Here are some example code:

assert null == null?[1];
assert null == null?[1]?[1, 2];
assert null == null?[1]?[1, 2]?[1, 2, 3];

def a = null;
assert null == a?[1, 2];

def f() {return null}
assert null == f()?[1];

       More information can be found at the safeIndex branch of
groovy-parser
project(https://github.com/danielsun1106/groovy-parser/tree/safeIndex)

       Any thoughts?

       BTW, the antlr4 branch of apache/groovy is very old, I am going to
try to update it with the master.

Cheers,
Daniel.Sun





--
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.



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