<div dir="ltr">On Tue, Feb 21, 2017 at 1:51 PM, Joe Groff via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For the review, Dave asked me to raise a design question on his behalf, since he&#39;s on vacation. There are places where the proposal introduces one-case types as a labeling mechanism to distinguish different operations with otherwise the same argument names, for instance:<br>
<br>
public enum ReportingOverflow { case reportingOverflow }<br>
<br>
protocol Number {<br>
  func adding(_ other: Self) -&gt; Self<br>
}<br>
<br>
protocol FixedWidthInteger: BinaryInteger {<br>
  func adding(_ other: Self, _: ReportingOverflow) -&gt; (partialValue: Self, overflow: ArithmeticOverflow)<br>
}<br>
<br>
This introduces an otherwise useless type (for which we need to emit metadata, provide documentation for, list in reference documentation and code completion, etc.) and turns the compiler&#39;s job of choosing among these operators into an overload resolution problem rather than a simpler name lookup problem. In other places, particularly when a type imported from Cocoa has multiple nullary initializers, we already use the convention of a Void-typed labeled argument, which would look like this:<br>
<br>
protocol FixedWidthInteger: BinaryInteger {<br>
  func adding(_ other: Self, reportingOverflow: Void) -&gt; (partialValue: Self, overflow: ArithmeticOverflow)<br>
}<br>
<br>
The call syntax is less aethestically pleasing, no doubt (`adding(5, reportingOverflow: ())`), but that&#39;s arguably a problem we should address at the language level given that we already have APIs that look like that. The tradeoff of ugly syntax, which we can potentially beautify over time, in return for less &quot;stuff&quot; in the standard library, which we can&#39;t get rid off once the dylib is burned into billions of user devices, is worth considering.<br></blockquote><div><br></div><div>+1. That seems like the wiser (if less &quot;clever&quot;) solution.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
</div></div></blockquote></div><br></div></div>