[swift-evolution] Proposal: Implement == and < for tuples where possible, up to some high arity
jtbandes at gmail.com
Mon Dec 7 17:04:30 CST 2015
On Mon, Dec 7, 2015 at 3:01 PM, Chris Lattner via swift-evolution <
swift-evolution at swift.org> wrote:
> On Dec 7, 2015, at 12:01 PM, Dmitri Gribenko via swift-evolution <
> swift-evolution at swift.org> wrote:
> I personally don't see a point in going as high as 12 tuple elements.
> About 4 or 5 makes sense to me. Given that Swift does not have variadic
> generics right now, these long tuples have to be defined by someone
> manually. If one is defining a tuple that is that long, I'd argue that
> they should be using a custom struct instead.
> I tend to agree with Dmitri here. Independent of the code size concern,
> what is the expected use-case for > 4 element tuples?
On the contrary, I think >4-element-tuples are useful exactly *for* the
case of custom structs. You wouldn't want the tuples themselves to be part
of your API, but if you have a custom struct with 4+ Comparable fields, you
can implement its < operator as simply "return (a1,b1,c1,d1,e1) <
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution