[swift-evolution] [Proposal] Custom operators
Антон Жилин
antonyzhilin at gmail.com
Tue Apr 5 10:29:49 CDT 2016
David Waite stated a major drawback of precedence groups.
People will often create tiny precedence groups for their modules, and user
will find that some of them should actually be the same. They will add
precedenceEqualTo, but all these equivalent groups will still exist. This
problem cannot occur with transitive precedence propagation. So precedence
groups really create more problems than solve.
- Anton
Apr 5, 2016, Антон Жилин wrote:
>
> On the other hand, in your solution you have a list of global rules
> and don't really need braces. How about this?
> #precedenceGroup(Additive)
> #precedenceGroup(Multiplicative)
> #precedence(Additive, less, Multiplicative)
> #operator(+, infix, associativity: left, group: Additive)
> #operator(*, infix, associativity: left, group: Multiplicative)
> #operator(<>, infix)
>
> So precedence group is just a tag that can be used in precedence rules and
> assigned to operators at declaration.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160405/afa406e7/attachment.html>
More information about the swift-evolution
mailing list