<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 12, 2017, at 1:37 PM, Slava Pestov 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="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><div dir="ltr" class=""><div class="">Before I submit it, could someone let me know if adding generics to subscripts would influence the ABI? ( still feel pretty clueless in that area).</div></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It won’t change the ABI of existing subscript calls, but if the standard library introduces new generic subscripts that replace older non-generic subscripts, it will impact ABI.</span></div></div><br class="Apple-interchange-newline"></div></blockquote></div><br class=""><div class="">Specifically, we currently have to have a&nbsp;<font face="Menlo" class="">_Hashable</font> protocol that has a&nbsp;<font face="Menlo" class="">_toAnyHashable() </font>method in order to implement&nbsp;<font face="Menlo" class="">Dictionary&lt;AnyHashable,*&gt; </font>subscripting using concrete types as keys. A replacement subscript that was generic over all <font face="Menlo" class="">Hashable</font> types would solve this more neatly, and would be source-compatible, but affects the ABI of the stdlib.&nbsp;</div><div class=""><br class=""></div><div class=""><a href="https://github.com/apple/swift/blob/master/stdlib/public/core/Hashable.swift#L16" class="">https://github.com/apple/swift/blob/master/stdlib/public/core/Hashable.swift#L16</a></div><div class=""><br class=""></div><div class="">Generic subscripts would also make it easier to implement one-sided ranges e.g.&nbsp;</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>myCollection[i...] // slice from i to the end</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""><br class=""></font></div></body></html>