groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roman Shaposhnik <ro...@shaposhnik.org>
Subject Re: Parrot and the ++ and -- operators
Date Sun, 12 Feb 2017 17:06:29 GMT
Well, for better of for worse this is the Groovy behavior as of today
(sorry for quoting myself -- but the thread there is interesting):
   https://twitter.com/rhatr/status/824033519684829185

Personally I find it surprising.

Thanks,
Roman.




On Sun, Feb 12, 2017 at 7:11 AM, Mauro Zallocco <mzallocco@gmail.com> wrote:
> Hi all.
>
> I tried this:
> groovy -version
> Groovy Version: 2.4.6 JVM: 1.8.0_66 Vendor: Oracle Corporation OS: Windows 7
>
> int i = 0
> ++(++(++i));
> assert i == 1
>
> However with C++, it gives 3.
>
> #include <assert.h>
>
> int main() {
>   int i = 0;
>   ++(++(++i));
>   assert(i==3);
>
>   return 0;
> }
>
> I think 3 is correct.
> True?
>
>
>
> On Tue, Jan 24, 2017 at 12:46 PM, Joe Wolf <joewolf@gmail.com> wrote:
>>
>> Good to know I'll be able to use these patterns in Groovy 3...I think :)
>>
>> -Joe
>>
>> On Tue, Jan 24, 2017 at 11:00 AM, Daniel Sun <realbluesun@hotmail.com>
>> wrote:
>>>
>>> Hi Joe,
>>>
>>>       I've added your sample code as test
>>>
>>> cases(https://github.com/danielsun1106/groovy-parser/commit/9914682e53fb2fe3d4bb335c8153e61066cea317).
>>> Parrot has same result with the old parser ;)
>>>
>>> Cheers,
>>> Daniel.Sun
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://groovy.329449.n5.nabble.com/Parrot-and-the-and-operators-tp5737960p5737973.html
>>> Sent from the Groovy Dev mailing list archive at Nabble.com.
>>
>>
>

Mime
View raw message