<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Consider even if we had compile-time constants like Vector<T, size: Int> — how would that be implemented? What would its backing-type be?</div></div></blockquote><div>Imho it's very simple — UnsafeMutableBufferPointer would be an obvious choice.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"> It would probably want to use that constant to create a fixed-length tuple;</div></div></blockquote><div>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).</div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">again, there would be less implementation effort by just having the tuple conform to Collection directly, instead.</div></div></blockquote></div>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.<div class="">Additionally, such an extension of generics would be useful for other things as well.</div><div class=""><br class=""></div><div class="">On the other hand, I think the change you suggest is rather fundamental:</div><div class="">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.</div><div class="">Most languages I know have a clean distinction between records/structs/tuples and arrays, and this makes sense.</div><div class="">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.</div><div class=""><br class=""></div><div class="">- Tino</div></body></html>