<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Yes, I think that’s better.<div class=""><div class=""><br class=""></div><div class="">I’m not sure how I feel about the “ing” at the end of the labels, but conceptually your idea is clearly the way to go, IMHO.</div><div class=""><br class=""></div><div class="">- Dave Sweeris</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 2, 2016, at 6:59 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hmm, a thought going in a slightly different direction: if these static functions were called like any other function, there might not be a need for having special rules for parameter labels, which can then be freed to denote prefix and postfix operators. In other words, we could have:</div><div class=""><br class=""></div><div class="">* for infix operators, no labels, like so: `static func + (_ lhs: T, _ rhs: T)`, used like this: `T.+(1, 2)`</div><div class="">* for prefix and postfix operators, a label, like so: `static func + (prefixing value: T)`, used like this: `T.+(prefixing: 1)`</div><div class="gmail_extra"><br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, May 2, 2016 at 6:26 PM, David Sweeris via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><span class=""><br class=""><blockquote type="cite" class="">On May 2, 2016, at 5:58 PM, Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">On May 2, 2016, at 1:56 PM, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""> How does one distinguish between calls to a static prefix operator and a<br class=""> static postfix operator with the same name?<br class=""><br class="">Ah, that's a tricky one that I don't have an immediate answer to, so I'm<br class="">definitely open to creative thoughts here.<br class=""></blockquote><br class="">One possibility: just use “qualified operator” notation.<br class=""><br class=""> lhs T.+= rhs<br class=""><br class=""> T.++x<br class=""> x T.++<br class=""></blockquote><br class="">I’m not sure if this is exactly right, but it seems close. I think that something like this is probably the best way to go, since it composes properly in arbitrary expressions. It does have a surface level weirdness to it, but it also "makes sense” in terms of how operators work. <br class=""></blockquote></span>Yeah… Maybe with parens?<blockquote style="margin:0 0 0 40px;border:none;padding:0px" class=""><div class="">T.++(x)</div><div class="">(x)T.++</div></blockquote><div class="">Or is that worse?</div><div class=""><br class=""></div><div class="">- Dave Sweeris</div></div><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="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></div></div></body></html>