<div dir="ltr">On Mon, Dec 26, 2016 at 2:57 PM, David Sweeris via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></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"><div dir="auto"><span class=""><div><br></div><div>On Dec 26, 2016, at 11:35, Tony Allevato <<a href="mailto:allevato@google.com" target="_blank">allevato@google.com</a>> wrote:<br><br></div><blockquote type="cite"><div>Mathematically, identities are associated with (type, operation) pairs, not types alone.<br><br>This conversation has put me in the column of "numeric types shouldn't have default initializers at all", personally.
</div></blockquote><br></span><div>I'd agree, except sometimes you need a T, <i>any</i> T, for when you want to create a "pre-sized" array for stuffing results into by index:</div><div>for i in ... {</div><div> a[i] = ...</div><div>}</div><div>Simply saying "var a =[T](); a.reserveCapacity()" doesn't cut it because it'll still crash if you try to store anything in a[i] without somehow putting at least i+1 elements in the array first.</div></div></blockquote><div><br></div><div>If you have _no_ guarantees as to what T is besides that it can be instantiated with T(), what's the point of having a [T] with not even a single actual T? Surely, there is nothing you can do with a [T] with a single placeholder T of which you have no knowledge other than it is a T? Why would you not reserve the capacity for a [T] at the point when you have at least one actual T?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>- Dave Sweeris</div></div><br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div></div>