[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 11:22:06 CST 2016
I only say attribute because that is what the grammar calls it in TSPL and I wanted to be precise. I agree that it is not an ideal name and that should probably also change in the docs.
--
Kevin Lundberg
> On Mar 6, 2016, at 12:59 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> 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
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list