[swift-evolution] Proposal: Adding precedence option for prefix and postfix operators

Sune Foldager cyano at me.com
Mon Jan 18 10:58:23 CST 2016

> On 17 Jan 2016, at 18:19, Jason Nielsen via swift-evolution <swift-evolution at swift.org> wrote:
> I'm afraid that is not a correct statement.  There is no arguing that -3^2 is -9 and that -3^2 and 0-3^2 are equivalent mathematically.  Exponentiation has higher precedence than - and subtraction is definitely an operator so -3^2 != (-3)^2.

A minus sign can represent both a part of an integer, a binary operator called subtraction and sometimes a prefix operator called negation, as far as mathematics go.


More information about the swift-evolution mailing list