[swift-evolution] [RFC] Definitive Initialization and Incompatibilities with Fixed-size Arrays

David Sweeris davesweeris at mac.com
Mon Jul 24 12:06:45 CDT 2017

> On Jul 24, 2017, at 9:37 AM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>> On Jul 23, 2017, at 4:27 PM, Félix Cloutier <felixcca at yahoo.ca> wrote:
>>>> Well, fixed-size arrays don’t have initializers, for the same reason tuples don’t: they’re compound types instead of named types and they literally have nowhere to place initializer definitions. But like tuples, FSAs have a literal syntax that works as a substitute for full-blown initializers.
>>> Ok, sure.  They aren’t literally initializers in the stdlib (they are built into the compiler), but they have initialization semantics and can be spelled in whatever way makes ergonomic sense.  Keeping them aligned with Array seems like a good starting point.
>> Either way, in the context of fixed-size arrays, I think that it's a broader problem that anonymous types can't have anything attached to them. This also prevents fixed-size arrays from conforming to protocols, even Sequence, and Swift would need variadic generics or (possibly, depending on the syntax) non-type generic parameters to even create a wrapper.
> Agreed. However, solving that general problem is hard, and completely orthogonal to the win of having fixed sized arrays work.

Is there really any doubt that we'll eventually get Variadic Generics and Non-Type Generic Parameters? They're always well-received whenever they come up, but they keep getting ruled out-of-scope before a proposal can be fully fleshed-out. I'm asking because it'd make it way easier to design a FSA proposal knowing that it could rely on those features. Personally, I'd even be ok with accepting such a proposal "pending the acceptance of its 'dependency proposals'" (with probably a quick re-review to make sure any subsequent proposals haven't materially changed how it'd work).

- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170724/c6c242b0/attachment.html>

More information about the swift-evolution mailing list