[swift-evolution] Proposal: Contiguous Variables (A.K.A. Fixed Sized Array Type)

Chris Lattner clattner at apple.com
Tue Feb 9 14:57:08 CST 2016

On Feb 9, 2016, at 11:33 AM, davesweeris at mac.com wrote:
>> This would solve the fixed size array use-case, be much easier to implement, and not have surprising performance issues promoting things to Any.  It is also consistent with the fact that we don’t infer the type of [Int(), Float()] to [Any].
>> -Chris
> (Sorry to go so far back… I started replying to this on probably the 29th and somehow forgot about it.)
> Out of curiosity, why would the subscript of non-homogeneous tuple have to return an "Any”? If we declare this:
> let grohl = (0, “foo”, “fighters”, 0.0)
> Why couldn’t subscript (and $0 in map, for that matter) return a type that’s the “intersection” of Int, String, and Double?

Swift has no such intersection type.  The closes analogs we have are Any (or if you allow boxing, NSObject/NSValue).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160209/39be6928/attachment.html>

More information about the swift-evolution mailing list