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

Jason Nielsen drjdnielsen at gmail.com
Wed Jan 20 00:54:35 CST 2016


If you can find a mathematically oriented text that distinguishes between
binary and prefix in regards to "-" I'll buy you a salad.


On Mon, Jan 18, 2016 at 11:58 AM, Sune Foldager <cyano at me.com> wrote:

> > 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.
>
> -Sune
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160120/042b274a/attachment.html>


More information about the swift-evolution mailing list