groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: Parrot and the ++ and -- operators
Date Tue, 14 Feb 2017 17:10:11 GMT


On 13.02.2017 23:58, Thibault Kruse wrote:
>
>
> On Feb 14, 2017 3:52 AM, "Jochen Theodorou" <blackdrag@gmx.org
> <mailto:blackdrag@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 VariableExpression is an expression consisting only
> if a variable name?

yes, but yes, you are right, there are also PropertyExpressions and 
ArrayExpressions... so I was narrowing it down too much.

> And this applies to both the pre and postfix ++ operator?
> So ++i++ would also stop compiling?

yes

> So the question could be rephrased as: is there any good usecase for ++
> outside the increment of a variable? Like
> x = (((a * b)++)/c)--

yes... and that even if considering we call next() for ++. I could 
imagine some crazy DSL to use this... but should we still consider doing 
this breaking change?

bye Jochen

Mime
View raw message