[swift-evolution] Variadic generics discussion

Daniel Vollmer lists at maven.de
Sat May 28 17:21:15 CDT 2016


Hi,


> On 28 May 2016, at 22:03, Austin Zheng via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hello swift-evolution,
> 
> I put together a draft proposal for the variadic generics feature described in "Completing Generics" as a major objective for Swift 3.x. It can be found here:
> 
> https://github.com/austinzheng/swift-evolution/blob/az-variadic-generics/proposals/XXXX-variadic-generics.md

I’ve only taken a short glance at this (and just like the proposal, I’m damaged by C++11, so my opinion is biased), so here are some thoughts:
- I’d prefer head + tail over first + rest, but that’s pretty irrelevant
- Often in C++, the need for recursion when using first + rest goes away when you can index into parameter packs (e.g. using integer_sequence) or have fold expressions.
- It might occasionally be useful to have multiple parameter packs (or argument packs). In C++ you can do that by wrapping it in a tuple. Do we have / need such an escape hatch?
- I have an argument pack. How would I apply a function taking a single argument to each element in the pack? Go via the tuple?
- Why is this a separate thing from Tuple itself? It feels so similar; I can convert between them, so why do I need this other thing?

	Daniel.



More information about the swift-evolution mailing list