[swift-evolution] [Pitch] New Version of Array Proposal

Tino Heth 2th at gmx.de
Mon Jul 24 06:29:19 CDT 2017

> I simply dislike the syntax, which in my opinion does not fit to Swift.

Also, I might have a different focus for the feature:
Performance and C interoperability are important, but I just want type safety and to avoid creating stupid things like Vector3, Vector4… which can't share code because there's no inheritance for structs (yet), and which are limited in expressiveness.

I don't think arrays should be multidimensional: Memory has only one dimension, this is a low level feature — and it's easy to build multi-dimensional structures on top of simple arrays.

I also have little need for a special syntax for literals: When the array is used as communication medium ("this function returns an array of size 3"), I'm not using literals at all, and when I'm declaring a array for my own use, I wouldn't mind if the compiler decides on his own that it can be fixed size.
There's also the use case of creating an array that will be handed over to a method that expects a FSA, but I wouldn't mind if I have to declare the type explicitly in this case.

Bottom line:
I prefer only one addition, and that is an extension of the generics system that has already been brought up in the manifesto.
With generics, the syntax for arrays is quite intuitive ("let speed: Array<Float, size: 3>"), and the usefulness isn't limited to FSAs alone — after all, Swift  is used in production for several years now without proper support for them.

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

More information about the swift-evolution mailing list