[swift-evolution] Proposal: change infix operator attributes syntax to be more consistent with the rest of the language

Kevin Lundberg kevin at klundberg.com
Sun Mar 6 13:50:50 CST 2016


> An improvement, but still seems strange to me to use the curly braces with argument-like syntax here. I don’t think there’s another instance of a syntax like this in Swift.
Absolutely, I feel the same way. Using parentheses does feel more
natural in this case.

>
> I’d be leaning more towards something like:
>
> infix operator <> (associativity: left, precedence: 100)
>
> or:
>
> operator <> (infix, associativity: left, precedence: 100)
>
> or even:
>
> #operator <> (infix, associativity: left, precedence: 100)
>
> to save up the “operator” keyword
I prefer the first option myself (my justification is in another reply
in this thread). Since operator is already a claimed keyword, I wonder
if there's any pressing need to relinquish it.



More information about the swift-evolution mailing list