<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">Swift is all about values and protocols, so I was thinking about smthg like this:</div><div class=""><div class=""><br class=""></div></div><div class=""><span style="font-size: 14px;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> OperatorAssociativity { </span></span><span style="background-color: rgba(255, 255, 255, 0); font-variant-ligatures: no-common-ligatures;" class="">case</span><span style="background-color: rgba(255, 255, 255, 0); font-variant-ligatures: no-common-ligatures;" class=""> left, right </span><span style="background-color: rgba(255, 255, 255, 0);" class="">}</span></span></div><div class=""><div style="margin: 0px; line-height: normal;" class=""><span style="background-color: rgba(255, 255, 255, 0); font-size: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> PrecedenceGroup {</span></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="background-color: rgba(255, 255, 255, 0); font-size: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">case</span><span style="font-variant-ligatures: no-common-ligatures;" class="">defaultGroup(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">OperatorAssociativity</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="background-color: rgba(255, 255, 255, 0); font-size: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">indirect</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">case </span><span style="font-variant-ligatures: no-common-ligatures;" class="">strongerThan(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">OperatorAssociativity</span><span style="font-variant-ligatures: no-common-ligatures;" class="">,</span><span style="font-variant-ligatures: no-common-ligatures;" class="">PrecedenceGroup</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="background-color: rgba(255, 255, 255, 0); font-size: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">indirect</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">case </span><span style="font-variant-ligatures: no-common-ligatures;" class="">weakerThan(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">OperatorAssociativity</span><span style="font-variant-ligatures: no-common-ligatures;" class="">,</span><span style="font-variant-ligatures: no-common-ligatures;" class="">PrecedenceGroup</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-size: 14px;" class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">indirect</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">case </span><span style="font-variant-ligatures: no-common-ligatures;" class="">between(</span><span style="font-variant-ligatures: no-common-ligatures;" class="">OperatorAssociativity</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span></span>strongerThan<span style="background-color: rgba(255, 255, 255, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">: </span><span style="font-variant-ligatures: no-common-ligatures;" class="">PrecedenceGroup, </span></span>weakerThan<span style="background-color: rgba(255, 255, 255, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">: </span></span>PrecedenceGroup<span style="background-color: rgba(255, 255, 255, 0);" class="">)</span></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="background-color: rgba(255, 255, 255, 0); font-size: 14px;" class="">}</span></div><div style="margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="background-color: rgba(255, 255, 255, 0); font-size: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="background-color: rgba(255, 255, 255, 0); font-size: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Additive: </span><span style="font-variant-ligatures: no-common-ligatures;" class="">PrecedenceGroup</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = .</span><span style="font-variant-ligatures: no-common-ligatures;" class="">defaultGroup</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">left</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="background-color: rgba(255, 255, 255, 0); font-size: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Multiplicative: </span><span style="font-variant-ligatures: no-common-ligatures;" class="">PrecedenceGroup</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = .</span><span style="font-variant-ligatures: no-common-ligatures;" class="">strongerThan</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">left</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures;" class="">Additive</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="background-color: rgba(255, 255, 255, 0); font-size: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">let</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> Exponentiative: </span><span style="font-variant-ligatures: no-common-ligatures;" class="">PrecedenceGroup</span><span style="font-variant-ligatures: no-common-ligatures;" class=""> = .</span><span style="font-variant-ligatures: no-common-ligatures;" class="">strongerThan</span><span style="font-variant-ligatures: no-common-ligatures;" class="">(.</span><span style="font-variant-ligatures: no-common-ligatures;" class="">left</span><span style="font-variant-ligatures: no-common-ligatures;" class="">, </span><span style="font-variant-ligatures: no-common-ligatures;" class="">Multiplicative</span><span style="font-variant-ligatures: no-common-ligatures;" class="">)</span></span></div></div><div class=""><span style="font-size: 14px;" class="">let SomeOtherGroup: PrecedenceGroup = .between(.right, strongerThan: Multiplicative, weakerThan: Exponentiative)</span></div><div style="font-family: Calibri, sans-serif; font-size: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div class=""><br class=""></div><div class="">standard Swift, which makes it easier to reflect when the api gets created in 4.0<br class=""><br class=""><div class="">Regards<div class="">LM</div><div class="">(From mobile)</div></div></div></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 24, 2016, at 2:47 PM, Anton Zhilin via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">L. Mihalkovic via swift-evolution <swift-evolution@...> writes:<br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">Could you please explain what you mean by "meta-circular syntax for <br class=""></blockquote></blockquote>the <br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">precedence group definitions"? An example?<br class=""></blockquote>=define it using existing swift constructs rather than by extending <br class=""></blockquote>swift with new kwd looks like grp<br class=""><blockquote type="cite" class="">matches a struct. <br class=""></blockquote><br class="">I still don't fully understand without an example :(<br class="">If you mean something like this:<br class=""><br class="">protocol PrecedenceGroup_Additive {<br class=""> associatedtype StrongerThan_Comparative<br class=""> associatedtype WeakerThan_Multiplicative<br class="">}<br class=""><br class="">Then this is just ugly.<br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></body></html>