groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Laforge <glafo...@gmail.com>
Subject Re: Negative relational operators for Groovy 3
Date Fri, 18 Nov 2016 13:05:31 GMT
On Fri, Nov 18, 2016 at 1:58 PM, Jochen Theodorou <blackdrag@gmx.org> 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
>> codes(https://github.com/danielsun1106/groovy-parser/blob/ne
>> gativeRelationalOperators/src/test/resources/core/NegativeRe
>> lationalOperators_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 >=.
>

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.

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

Blog: http://glaforge.appspot.com/
Social: @glaforge <http://twitter.com/glaforge> / Google+
<https://plus.google.com/u/0/114130972232398734985/posts>

Mime
View raw message