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

Dave Abrahams dabrahams at apple.com
Sat Mar 5 23:59:49 CST 2016


on Sat Mar 05 2016, Kevin Lundberg <swift-evolution at swift.org> wrote:

> Ever since Swift 1.0 I've found the infix operator attribute syntax strange:
>
> infix operator <> { associativity left precedence 100 }
>
> The value of the attribute has no visual cue that ties it to the name of
> the attribute. One could arguably read left as its own attribute name
> rather than the value set to the associativity attribute, or could read
> the wrong pair as one attribute, like "left precedence".
>
> In the spirit of Erica Sadun's recent proposal ... using : over =, I'd
> like to see operator declaration syntax follow a similar structure:
>
> infix operator <> { associativity: left, precedence: 100 }
>

<schnipp>

> Any thoughts?

LGTM, but  you shouldn't use the term “attribute” here; it has a
different meaning in Swift and it's *really* confusing when reading your
proposal.

-- 
-Dave



More information about the swift-evolution mailing list