[ https://issues.apache.org/jira/browse/GROOVY-7428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14549340#comment-14549340 ]
ASF GitHub Bot commented on GROOVY-7428: ---------------------------------------- GitHub user paulk-asert opened a pull request: https://github.com/apache/incubator-groovy/pull/18 GROOVY-7428: Change precedence priority of ** compared to pre/post in… …c/dec and unary plus/minus You can merge this pull request into a Git repository by running: $ git pull https://github.com/paulk-asert/incubator-groovy groovy7428 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-groovy/pull/18.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #18 ---- commit a0afb0e814bdaec656fa48e53d417b0bb7051348 Author: Paul King <pa...@asert.com.au> Date: 2015-05-18T22:04:34Z GROOVY-7428: Change precedence priority of ** compared to pre/post inc/dec and unary plus/minus ---- > 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 > Labels: breaking > > 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)