groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Sun <>
Subject Re: Negative relational operators for Groovy 3
Date Fri, 18 Nov 2016 13:24:21 GMT
OK. As most of us just like !in and !instanceof and prefer the sticky style, I will modify
them later. Thanks for your review ;)


在 "Guillaume Laforge [via Groovy]" <>,2016年11月18日

On Fri, Nov 18, 2016 at 2:05 PM, Guillaume Laforge <[hidden email]> wrote:

On Fri, Nov 18, 2016 at 1:58 PM, Jochen Theodorou <[hidden email]> wrote:

On 18.11.2016 13:45, Daniel Sun wrote:
Hi all,

      The new parser(Parrot) supports negative relational operators now,
which is proposed by Guillaume Laforge :)

      Here are some example

assert 'a' instanceof String
assert 'a' !instanceof Integer
assert 1 <= 2
assert 2 !<= 1
assert 2 >= 1
assert 1 !>= 2
assert 1 < 2
assert 2 !< 1
assert 2 > 1
assert 1 !> 2
assert 1 in [1, 2]
assert 3 !in [1, 2]

I think !instanceof and !in are ok. The others... not sure here. Right now a<b uses the
same method as a>=b, which means !< is >=. And in this case I actually prefer >=.

For instanceof and in, that's nice, but I think it's too cryptic for the other ones, which
do exist in a different form, as currently !< is just >=, as Jochen says.

In terms of "groovy style", I think I'd prefer to have the ! sticking to in and instanceof.
It might also be less confusing to parse, should we some day add something like a factorial
operator, or some other use for the !

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

Social: @glaforge<> / Google+<>

If you reply to this email, your message will be added to the discussion below:
To unsubscribe from Negative relational operators for Groovy 3, click here<>.

View this message in context:
Sent from the Groovy Dev mailing list archive at
View raw message