[swift-evolution] [Pitch] Require "infix" for infix operator function declarations

Jacob Bandes-Storch jtbandes at gmail.com
Mon Jul 11 23:03:45 CDT 2016

Currently, "infix" is not required/allowed on an operator function
definition, but "prefix" and "postfix" are:

    prefix operator ^^ {}   // valid
    postfix operator ^^ {}  // valid
    infix operator ^^ {}    // valid

    prefix func ^^(operand: Int) {}  // valid
    postfix func ^^(operand: Int) {} // valid
    infix func ^^(lhs: Int, rhs: Int) {}   // *error: *'infix' modifier is
not required or allowed on func declarations
    func ^^(lhs: Int, rhs: Int) {}         // valid

It seems like this was removed because it can be inferred from the number
of arguments (
But IMO the inconsistency from other operator function decls/defs is

How does everyone feel about reinstating the "infix" modifier on functoins?
(It was removed before the open-source release and the advent of
swift-evolution, so I thought it'd be worth a public review.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160711/b22d2158/attachment.html>

More information about the swift-evolution mailing list