[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.
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?
> #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...
More information about the swift-evolution