Re: Parrot and the ++ and -- operators

2017-02-14 Thread Jochen Theodorou
On 13.02.2017 23:58, Thibault Kruse wrote: On Feb 14, 2017 3:52 AM, "Jochen Theodorou" mailto:blackd...@gmx.org>> wrote: Options: (2) do allow these post- and prefix operators only on VariableExpressions, making the code above no longer compile Just to be sure, a VariableExpr

Re: Parrot and the ++ and -- operators

2017-02-14 Thread Joe Wolf
This isn't a good idea at all, but you can produce the C++ behavior by overriding next() in a mutable fashion, e.g. @groovy.transform.TupleConstructor class Bar { int value Bar next() { ++value this } } Bar b = new Bar(0) ++(++(++b)) assert b.value == 3 But in reality