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

More smthg like this:

protocol PrecedGrpType{}
enum OperatorAssociativity { case left, right }
enum PrecedenceGroup {
    indirect casestrongerThan(OperatorAssociativity,PrecedenceGroup)
    indirect caseweakerThan(OperatorAssociativity,PrecedenceGroup)

let Additive: PrecedenceGroup = .defaultGroup(.left)
let Multiplicative: PrecedenceGroup = .strongerThan(.left, Additive)
let Exponentiative: PrecedenceGroup = .strongerThan(.left, Multiplicative)

standard Swift, which makes it easier to reflect when the api gets created in 40

(From mobile)


On Jun 24, 2016, at 2:47 PM, Anton Zhilin via swift-evolution <swift-evolution@swift.org> wrote:

L. Mihalkovic via swift-evolution <swift-evolution@...> writes:

Could you please explain what you mean by "meta-circular syntax for


precedence group definitions"? An example?

=define it using existing swift constructs rather than by extending

swift with new kwd looks like grp

matches a struct.

I still don't fully understand without an example :(
If you mean something like this:

protocol PrecedenceGroup_Additive {
   associatedtype StrongerThan_Comparative
   associatedtype WeakerThan_Multiplicative

Then this is just ugly.

swift-evolution mailing list