groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Reopened] (GROOVY-7428) Change precedence priority of ** compared to pre/post inc/dec and unary plus/minus
Date Tue, 09 Jun 2015 11:14:00 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-7428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Paul King reopened GROOVY-7428:
-------------------------------

following discussion on the mailing list we might want to relook at this

> Change precedence priority of ** compared to pre/post inc/dec and unary plus/minus
> ----------------------------------------------------------------------------------
>
>                 Key: GROOVY-7428
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7428
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Assignee: Paul King
>              Labels: breaking
>             Fix For: 2.5.0-beta-1
>
>
> Currently the precedence order is:
> {noformat}
> level 1: post inc/dec
> level 2: power
> level 3: pre inc/dec
> {noformat}
> The original intention, I believe, was always:
> {noformat}
> level 1: post inc/dec
> level 2: pre inc/dec
> level 3: power
> {noformat}
> This leads to some unintuitive behavior:
> while these are the same:
> {code}
> println (-9 + 2)  //  -7
> println ((-9) + 2)  //  -7
> {code}
> these are different:
> {code}
> println (-9 ** 2)  //  -81  actually: println (-(9 ** 2))
> println ((-9) ** 2)  //  81
> {code}
> Similar anomalies occur between {{**}} and {{++}}/{{--}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message