<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On Jan 9, 2018, at 9:04 PM, Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><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="">The problem is that this isn't currently expressible in the type system. If we can, </span>I would actually support including some kind of unprincipled private hack so we could say `where Element: _AnyTupleOfTwo`.</div></blockquote></div><div class=""><br class=""></div><div class="">Sorry, I meant to provide an alternative but forgot.</div><div class=""><br class=""></div><div class="">If we can't do this, I think we should call it something like `PairArray` or `KeyValueArray` and augment its API to bring it closer to parity with `Array`. This type really does have the same semantics as `Array`—integer-indexed, order-preserving, random-access, etc.—and I think we should leverage that fact to make its behavior clear.</div><div class=""><br class=""></div><div class="">`PairArray` sort of vaguely suggests that we should have a `public typealias Pair<K, V> = (key: K, value: V)` in the standard library. I think that's actually a good idea, because we can use it to make sure that we use tuple element labels consistently across various APIs.</div><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal; border-spacing: 0px;"><div class=""><div style="font-size: 12px; " class="">-- </div><div style="font-size: 12px; " class="">Brent Royal-Gordon</div><div style="font-size: 12px; " class="">Architechies</div></div></span>
</div>
<br class=""></body></html>