[swift-evolution] Variadic generics discussion
clattner at apple.com
Tue May 31 19:51:29 CDT 2016
> On May 31, 2016, at 6:05 PM, Joe Groff <jgroff at apple.com> wrote:
>> On May 31, 2016, at 12:49 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>>> On May 31, 2016, at 12:17 PM, L Mihalkovic via swift-evolution <swift-evolution at swift.org> wrote:
>>> well there is no macro system, and for the moment a clear statement from chris that this is not on the table in the short term. the code in the example looked like run-of-the-mill swift, except for the “…". so that leaves us with swift looking code that would be executed by the compiler, but with nothing particular to tell which parts to and which not. just a thought.
>> Lets be clear though: variadic generics are not in scope for Swift 3 either.
>> I definitely don’t speak for the rest of the core team, nor have I discussed it with them… but IMO, this whole feature seems like a better fit for a macro system than it does to complicate the generics system. Unlike C++’s template system, our generics system inherently has runtime / dynamic dispatch properties, and I don’t think that shoehorning variadics into it is going to work out well.
> There's definitely the possibility of going off the deep end with complexity like C++, but since we already have tuples as a primitive language feature, I think there's a straightforward language design that enables the most important use cases for variadics. If we have "tuple splatting" for argument forwarding, and some support for iterating tuples, like we briefly discussed in the context of (4 x Int) fixed-sized homogeneous tuples, that'd probably be enough.
Ok, fair enough. However, I think that it is inescapable that any discussion of variadic generics needs to include implementation concerns.
More information about the swift-evolution