[swift-evolution] [Returned for revision] SE-0077: Improved operator declarations

Anton Zhilin antonyzhilin at gmail.com
Thu Jun 23 10:32:57 CDT 2016


Ross O'Brien via swift-evolution <swift-evolution at ...> writes:

> The naming suggestion: why not simply 'precedes' and 'succeeds'? This 
avoids the conjoined words problem. Then you're just writing 
'Multiplication { succeeds: Exponentiation, precedes: Addition }'.

I still believe that `above` and `below` are clearer.

> Suppose wanted to define C's precedence so its operation preceded both A 
and B, or succeeded both A and B. Does that require an explicit 
declaration of which of A or B takes precedence? If not, would this be 
legal?:
> 'precedencegroup C { strongerThan: A, strongerThan: B }'

Any number of strongerThan and weakerThan relationships should be legal.
Order of these relationships does not matter. We model them as edges of a 
DAG of all declared operators.

There will be no problems during parsing. For example,
https://en.wikipedia.org/wiki/Shunting-yard_algorithm
only requests equality and less-than relationships between two operators.

- Anton



More information about the swift-evolution mailing list