[swift-evolution] Proposal: Adding precedence option for prefix and postfix operators
David Sweeris
davesweeris at mac.com
Wed Jan 20 02:17:48 CST 2016
TI graphing calculators (at least the ones I've used have different buttons for binary and prefix -, does that count? I'm not sure if they behave differently WRT precedence, though.
What if an operator's precedence could be changed by specific functions? Like +(Int, Int) -> Int is 100 (or whatever the default is), but +(MyType, MyType) has precedence 3?
Does that break anything?
> On Jan 19, 2016, at 22:54, Jason Nielsen via swift-evolution <swift-evolution at swift.org> wrote:
>
> 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
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160120/43daae3d/attachment.html>
More information about the swift-evolution
mailing list