[swift-evolution] [Proposal] Custom operators

Félix Cloutier felixcca at yahoo.ca
Sun Apr 3 13:49:44 CDT 2016


That doesn't sound future-proof. If it was in place and Range hadn't existed since the earliest Swift public release, it wouldn't be possible to define its precedence now.

Félix

> Le 3 avr. 2016 à 11:41:00, Ben Rimmington via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> <https://github.com/Anton3/swift-evolution/blob/operator-precedence/proposals/
> NNNN-operator-precedence.md>
> 
> Another way to eliminate numerical precedence is by using keywords:
> 
> infix operator << {
>    associativity none
>    exponentiative
> }
> 
> infix operator * {
>    associativity left
>    multiplicative
> }
> 
> infix operator + {
>    associativity left
>    additive
> }
> 
> infix operator == {
>    associativity none
>    comparative
> }
> 
> infix operator += {
>    associativity right
>    assignment
> }
> 
> All operators would need to use one of the existing precedence groups (Table 2):
> 
> <https://developer.apple.com/library/ios/documentation/Swift/Reference/
> Swift_StandardLibrary_Operators/>
> 
> -- Ben
> 
> _______________________________________________
> 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/20160403/39290f79/attachment.html>


More information about the swift-evolution mailing list