> Allowing partial indexing as you show it privileges one dimension over the > others, although they’re supposed to be co-equal and the reason a particular > dimension is privileged is due to an implementation detail.
Isn’t this a pretty important implementation detail? One of the reasons for introducing FSAs is for performance; physical memory layout is a key part of performance. Indexing the first k dimensions will return a contiguous block of memory, which is fast to read (in my simple mental model of memory, you’d only need a start position and a buffer length, although it’s probably more complicated than this in reality) and also cache-friendlier than accessing arbitrary indices due to the contiguity of the memory. This is an important optimization and programmers should be able to take advantage of it. I wouldn’t oppose arbitrary partial indexing, but would suggest that to specify the indices along arbitrary dimensions require a method to indicate the performance cost of reading (and writing?) non-contiguous memory. > On Jul 23, 2017, at 11:22 PM, Daryle Walker via swift-evolution > <swift-evolution@swift.org> wrote: > > Allowing partial indexing as you show it privileges one dimension over the > others, although they’re supposed to be co-equal and the reason a particular > dimension is privileged is due to an implementation detail. _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution