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_ exp
Yeah, I like the idea too :)
Cheers,
Daniel.Sun
--
View this message in context:
http://groovy.329449.n5.nabble.com/Safe-index-for-Groovy-3-tp5736558p5736562.html
Sent from the Groovy Dev mailing list archive at Nabble.com.
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 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 nul
groovy-all-2.5.0-SNAPSHOT jar file used by groovy-parser is a bit outdated,
the following usual code can not be executed too(but it can be executed by
2.4.7...), so the static complication test cases will be added later :)
@CompileStatic
int cs() {
List a = [1, 2, 3]
return a[0];
}
cs();
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