[swift-evolution] Checking in; more thoughts on arrays and variadic generics
Daryle Walker
darylew at mac.com
Sun Feb 5 15:27:14 CST 2017
> On Jan 27, 2017, at 4:25 PM, Slava Pestov <spestov at apple.com> wrote:
>
>
>> On Jan 27, 2017, at 11:44 AM, Karl Wagner via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>
>
>> as would CollectionOfOne<T>, to be replaced by a single-element tuple (T).
>
> For what it’s worth, Swift doesn’t have single-element tuples. (T) is just sugar for the type T itself.
You could use “(repeat T for 1)” if you really wanted. (I wonder if I should allow “(…, repeat T for 0)” to define trailing array segments.)
My concept always had the array directive within a “()”. One, the isolation (hopefully) prevents “repeat” and/or “for” from being parsed for their statement meanings. Two, I think “repeat repeat T for N for M” looks awful compared to “(…, repeat (repeat T for N) for M,… )”.
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170205/71f61ec3/attachment.html>
More information about the swift-evolution
mailing list