groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ocs@ocs.cz" <...@ocs.cz>
Subject Re: Safe index for Groovy 3
Date Tue, 08 Nov 2016 16:31:58 GMT
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, „full-safe“ mode, where
one could set some switch (probably would need to be a compile-time one I guess) to get implicitly
the „safe mode“ 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 <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.


Mime
View raw message