groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: Negative relational operators for Groovy 3
Date Fri, 18 Nov 2016 12:58:58 GMT


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
> codes(https://github.com/danielsun1106/groovy-parser/blob/negativeRelationalOperators/src/test/resources/core/NegativeRelationalOperators_01x.groovy):
>
> 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 >=.

bye Jochen

Mime
View raw message