[swift-evolution] Default Generic Arguments

Alexis abeingessner at apple.com
Thu Feb 2 12:49:42 CST 2017


> On Jan 27, 2017, at 4:43 PM, Anton Zhilin via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Current alternative to default generic arguments is typealias, like basic_string and string in C++:
> 
> struct BasicBigInt<T> { ... }
> typealias BigInt = BasicBigInt<Int64>
This is a really great point, but it should be noted that this is only sufficient to accomplish source-stability. Once the standard library starts providing ABI stability, this solution won’t work for it — the type of BigInt will become BasicBigInt<Int64> which will change mangling and other things. 

First-class generic defaults, on the other hand, have the potential to be built out so that any binary compiled against the old type definition continues to work. The details of what this looks like depends on precisely how the final ABI shakes out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170202/df221038/attachment.html>


More information about the swift-evolution mailing list