[swift-evolution] [Pre-pitch] Conditional default arguments

Matthew Johnson matthew at anandabits.com
Tue Nov 28 09:42:02 CST 2017

> On Nov 28, 2017, at 12:34 AM, Slava Pestov <spestov at apple.com> wrote:
>> On Nov 27, 2017, at 3:38 PM, Matthew Johnson via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> You are effectively proposing that in this very narrow case we perform overload resolution on a symbol in a generic type context *after* the generic type has been replaced with a concrete type. 
> Keep in mind that in general, this would require runtime support — we don’t always know the concrete substitution for a generic parameter at compile time, especially in the presence of separate compilation (but even without, for instance when optimizations are not enabled or unable to recover concrete type information).

Thanks for mentioning that.  IMO, it rules out this approach as it means we wouldn’t always know statically whether a default argument is available.  C++ gets away with it because templates are always substituted during compilation and that isn’t true for Swift generics.

> Slava

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171128/a380bad1/attachment.html>

More information about the swift-evolution mailing list