[swift-evolution] [Review] SE-0077: Improved operator declarations

John McCall rjmccall at apple.com
Fri May 20 15:51:51 CDT 2016

> On May 20, 2016, at 1:25 PM, Антон Жилин <antonyzhilin at gmail.com> wrote:
> Inline:
> 2016-05-20 20:58 GMT+03:00 John McCall <rjmccall at apple.com <mailto:rjmccall at apple.com>>:
> The transitivity rule plus the ability to define precedence relationships in both directions on a new precedence group allows a new precedence group to create a precedence relationship between existing unrelated precedence groups.  This should be forbidden.
> Agreed, although there is an alternate solution to allow global-scope relationship definition.
> Trying to write it formally:
> ====begin====
> Precedence relationships that, by transitivity rule, create relationship between two imported groups, is an error. Example:
> // Module X
> precedencegroup A { }
> precedencegroup C { }
> // Module Y
> import X
> precedencegroup B { precedence(> A) precedence(< C) }
> This results in compilation error "B uses transitivity to define relationship between imported groups A and C".
> The rationale behind this is that otherwise one can create relationships between standard precedence groups that are confusing for the reader.
> ====end====

Seems good to me.

> What's the purpose of equality relationships between precedence groups?
> Agreed, will remove.

> Your proposal should call out the special treatment of the Assignment and Ternary groups.
> Do you mean that most operators should define greater precedence than Assignment / Ternary? Or there should be some other special treatment?

Just that they have implicit members.

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

More information about the swift-evolution mailing list