> On Jan 9, 2018, at 9:04 PM, Brent Royal-Gordon via swift-evolution > <[email protected]> wrote: > > The problem is that this isn't currently expressible in the type system. If > we can, I would actually support including some kind of unprincipled private > hack so we could say `where Element: _AnyTupleOfTwo`.
Sorry, I meant to provide an alternative but forgot. 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. `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. -- Brent Royal-Gordon Architechies
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
