Tony, thanks for writing this up! on Mon May 02 2016, Tony Allevato <swift-evolution@swift.org> wrote:
> Other kinds of operators (prefix, postfix, assignment) > > Static operator methods have the same signatures as their global counterparts. > So, for example, prefix and postfix operators as well as assignment operators > would be defined the way one would expect: > > protocol SomeProtocol { > static func +=(lhs: inout Self, rhs: Self) > static prefix func ~(value: Self) -> Self > > // This one is deprecated, of course, but used here just to serve as an > // example. > static postfix func ++(value: inout Self) -> Self > } > > // Trampolines > func += <T: SomeProtocol>(lhs: inout T, rhs T) { > T.+=(&lhs, rhs) > } > prefix func ~ <T: SomeProtocol>(value: T) -> T { > return T.~(value) > } > postfix func ++ <T: SomeProtocol>(value: inout T) -> T { > return T.++(&value) > } How does one distinguish between calls to a static prefix operator and a static postfix operator with the same name? -- Dave _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution