> Consider even if we had compile-time constants like Vector<T, size: Int> — 
> how would that be implemented? What would its backing-type be?
Imho it's very simple — UnsafeMutableBufferPointer would be an obvious choice.

> It would probably want to use that constant to create a fixed-length tuple;
No, it would use that constant to create a fixed-size array of bytes. Don't 
forget that everything boils down to arrays of bytes (tuples included).

> again, there would be less implementation effort by just having the tuple 
> conform to Collection directly, instead.
Well, it's already trivial to build Vector4<T> instead of Vector<T, size: 4> 
using current Swift, so imho the step shouldn't be big — and it is obvious to 
interpret the meaning of this small syntax addition.
Additionally, such an extension of generics would be useful for other things as 
well.

On the other hand, I think the change you suggest is rather fundamental:
It requires a syntax which is completely new (without an obvious choice on how 
that syntax should look), and I see no reason for Swift to take a special path.
Most languages I know have a clean distinction between records/structs/tuples 
and arrays, and this makes sense.
Iterating over the elements in a tuple is like iterating over the properties in 
a struct or class, and (metaprogramming aside) that feels very strange to me.

- Tino

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to