<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On 31 Jan 2017, at 20:53, Max Moiseev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi Brent,<br class=""><br class="">Thanks a lot for your suggestions! After having discussed them with Dave, we came up with the following design that I personally like a lot.<br class=""><br class="">enum Overflowing { case .withOverflow }<br class="">enum FullWidth { case .fullWidth }<br class=""><br class="">protocol FixedWidthInteger {<br class=""> &nbsp;func adding(_ other: Self, _: Overflowing) -&gt; (partialValue: Self, overflow: ArithmeticOverflow)<br class=""> &nbsp;func subtracting(_ other: Self, _: Overflowing) -&gt; (partialValue: Self, overflow: ArithmeticOverflow)<br class=""> &nbsp;func multiplied(by other: Self, _: Overflowing) -&gt; (partialValue: Self, overflow: ArithmeticOverflow)<br class=""> &nbsp;func divided(by other: Self, _: Overflowing) -&gt; (partialValue: Self, overflow: ArithmeticOverflow)<br class=""><br class=""> &nbsp;func multiplied(by other: Self, _: FullWidth) -&gt; DoubleWidth&lt;Self&gt;<br class=""> &nbsp;func dividing(_ other: DoubleWidth&lt;Self&gt;, _: FullWidth) -&gt; (quotient: Self, remainder: Self)<br class="">}<br class=""><br class=""><br class="">Call sites would look like:<br class=""><br class="">x.multiplied(by: y, .withOverflow) and x.multiplied(by: y, .fullWidth)<br class=""><br class="">a little different for the division:<br class=""><br class="">x.divided(by: y, .withOverflow) and y.dividing(x, .fullWidth)<br class=""><br class="">Note the inverse-ness of `dividing`, but the lack of the argument label makes it quite natural.</div></div></blockquote><br class=""></div><div>While I applaud the ingenuity behind this solution, it seems an odd thing to do, and I wonder if it's something that might become obsolete in the future?</div><div><br class=""></div><div>I mean, since the purpose of this is just to select the correct method declaration, then the more "correct" way to do this would be using labelled Void arguments, but of course these aren't as neat right now:</div><div><br class=""></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>protocol FixedWithInteger {</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>func adding(_ other:Self, withOverflow:Void) -&gt; (partialValue:Self, overflow:ArithmeticOverflow)</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</font></div><div><font face="Monaco" class=""><br class=""></font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>x.add(y, withOverflow:())</font></div><div><br class=""></div><div>This uses the method's label to avoid the need to declare enums purely for selection. The problem is of course that the syntax isn't that great because of the extraneous :(). It would be better if we could just do x.add(y, withOverflow:), but that might be ambiguous because using labels without values is how we select labelled functions (e.g- let f = adding(:withOverflow:) would select the method).</div><div><br class=""></div><div>I'm just wondering if there's a change to labelled void arguments that we could make that would allow that style to be used instead? It just feels to me like using a labelled Void is the "proper" way to achieve what is needed, and that using enums just because it isn't possible right now is something that could become obsolete in future.</div><div><br class=""></div><div>- Haravikk</div></body></html>