[swift-evolution] [Draft] Resolving operator precedence conflicts

Dave Abrahams dabrahams at apple.com
Tue Mar 8 18:36:09 CST 2016


on Tue Mar 08 2016, Антон Жилин <swift-evolution at swift.org> wrote:

> There have been complaints on current syntax of operator declarations:
>
> infix operator <> { associativity left precedence 100 assignment }
>
> It looks like a collection of random words. Dictionary syntax would suit
> better here. Additionally, `assignment` has been deprecated for a long
> time, but not removed.
>
> Many syntaxes were suggested. For example:
>
> #operator(<>, fixity: infix, associativity: left, precedence: 100)
>
> *But* Joe Groff uncovered a deeper problem. Current operators cannot be
> given precedence and associativity per concrete operator function.

I'm not a compiler implementor, but I think changing that would be next
to impossible.  We need to be able to parse the code before we can do
type-dependent analysis such as overload resolution.

-- 
-Dave



More information about the swift-evolution mailing list