<div dir="ltr"><div><span style="font-size:12.8px">> </span><span style="font-size:12.8px">For integers, 0 is an additive identity. Is there a reason it should be given special treatment over 1, the multiplicative identity?</span><span style="font-size:12.8px"> </span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">E.g. for statistical reasons. When I have a collection of users with age etc it makes sense to ask what is the combined age of the collection? What is the semantic meaning of multiplying their ages? </span></div><span style="font-size:12.8px"><div><span style="font-size:12.8px"><br></span></div>> Mathematically, identities are associated with (type, operation) pairs, not types alone.</span><br><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Correct, however we aren't talking about mathematics, we are talking about the implementation of a language that runs on very concrete architectures where very concrete bit patterns mean very concrete things that are unlikely to change any time soon.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 26, 2016 at 11:35 AM, Tony Allevato <span dir="ltr"><<a href="mailto:allevato@google.com" target="_blank">allevato@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For integers, 0 is an additive identity. Is there a reason it should be given special treatment over 1, the multiplicative identity? Historically the only reason is because it has the all-clear bit pattern.<br><br>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.<br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Mon, Dec 26, 2016 at 11:27 AM Adam Nemecek via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr" class="m_-5389545831853979663gmail_msg">The elements already have an Identity, the one that you get when you invoke the default constructor. It's 0 for Int, "" for String. </div><div class="gmail_extra m_-5389545831853979663gmail_msg"><br class="m_-5389545831853979663gmail_msg"><div class="gmail_quote m_-5389545831853979663gmail_msg">On Mon, Dec 26, 2016 at 11:24 AM, David Sweeris <span dir="ltr" class="m_-5389545831853979663gmail_msg"><<a href="mailto:davesweeris@mac.com" class="m_-5389545831853979663gmail_msg" target="_blank">davesweeris@mac.com</a>></span> wrote:<br class="m_-5389545831853979663gmail_msg"><blockquote class="gmail_quote m_-5389545831853979663gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class="m_-5389545831853979663gmail_msg"><div class="m_-5389545831853979663gmail_msg"><div class="m_-5389545831853979663m_7699876098764341631h5 m_-5389545831853979663gmail_msg"><div class="m_-5389545831853979663gmail_msg"><br class="m_-5389545831853979663gmail_msg"></div><div class="m_-5389545831853979663gmail_msg">On Dec 26, 2016, at 11:12, Tino Heth via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="m_-5389545831853979663gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="m_-5389545831853979663gmail_msg"><br class="m_-5389545831853979663gmail_msg"></div><blockquote type="cite" class="m_-5389545831853979663gmail_msg"><div class="m_-5389545831853979663gmail_msg">There is an older discussion that is somewhat linked to this topic:<div class="m_-5389545831853979663gmail_msg">"Removing the empty initialiser requirement from RangeReplaceableCollection"<br class="m_-5389545831853979663gmail_msg"><div class="m_-5389545831853979663gmail_msg"><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160704/023642.html" class="m_-5389545831853979663gmail_msg" target="_blank">https://lists.swift.org/<wbr>pipermail/swift-evolution/<wbr>Week-of-Mon-20160704/023642.<wbr>html</a></div><div class="m_-5389545831853979663gmail_msg"><br class="m_-5389545831853979663gmail_msg"></div></div><div class="m_-5389545831853979663gmail_msg">Imho "DefaultConstructible" types can be very handy, but so far, it seems no one has presented a single use case that is important enough to justify the inclusion in the stdlib.</div><div class="m_-5389545831853979663gmail_msg">On the other hand, I'm quite sure that there's much functionality in the stdlib that many people consider as superfluous…</div><div class="m_-5389545831853979663gmail_msg"><br class="m_-5389545831853979663gmail_msg"></div><div class="m_-5389545831853979663gmail_msg">I guess adding the protocol wouldn't have a big impact on size, so for for me, the question is "Does this protocol confuse users of Swift?", which I'd answer with "yes, possibly" (unless someone comes up with a name that is more intuitive).</div></div></blockquote><br class="m_-5389545831853979663gmail_msg"></div></div><div class="m_-5389545831853979663gmail_msg">"Identity", but, at least for many numeric types, you'd need a mechanism for specifying which one you mean.</div><div class="m_-5389545831853979663gmail_msg"><br class="m_-5389545831853979663gmail_msg"></div><div class="m_-5389545831853979663gmail_msg">- Dave Sweeris</div></div></blockquote></div><br class="m_-5389545831853979663gmail_msg"></div></div></div><span class="">
______________________________<wbr>_________________<br class="m_-5389545831853979663gmail_msg">
swift-evolution mailing list<br class="m_-5389545831853979663gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="m_-5389545831853979663gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="m_-5389545831853979663gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="m_-5389545831853979663gmail_msg" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br class="m_-5389545831853979663gmail_msg">
</span></blockquote></div>
</blockquote></div><br></div>