Chris, thanks for commenting, but see below: On 4/9/16 10:33, Chris Lattner via swift-evolution wrote: >> On Apr 8, 2016, at 5:16 AM, Rainer Brockerhoff via swift-evolution >> <swift-evolution@swift.org> wrote: >>> - I definitely agree that a partial ordering between precedences is all >>> that we need/want, and that unspecified relations should be an error. >>> ... >>> Question for you: have you considered introducing named precedence groups, >>> and having the relationships be between those groups? For example, I could >>> see something like: >>> >>> operator group additive {} >>> operator group multiplicative { greaterThan: additive } >>> operator group exponential { greaterThan: additive } >> >> Also +10, would be interested in your opinion about: >> >> 1) disallowing adding new operator groups outside the stdlib; > > I don’t see why we would do that. This would lead us directly into > the world of C++ operator overloading, where everyone reuses existing > operators instead of defining their new and unique operators. IMO it > is much better to "know that you don’t know” what a symbol is, rather > than assuming it has the obvious semantics and being surprised > because it was overloaded.
I agree with you a 100% regarding new operators, but notice I said "adding new operator GROUPS". I don't see much sense in adding a new precedence group beyond the ones already defined. This goes along with your comment later in this thread: > ...This would require using parentheses to disambiguate... which I always do — I never remember most of the precedences. >> 2) disallowing adding operators to uncommon groups like subscripting, >> function calls, etc. > Subscripting and function calls are not operators. Oops, right. I meant in the context of "expressions", as used in the Swift book. -- Rainer Brockerhoff <rai...@brockerhoff.net> Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." http://brockerhoff.net/blog/ _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution