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

Matthew Johnson matthew at anandabits.com
Tue Nov 28 16:13:56 CST 2017


> On Nov 28, 2017, at 4:11 PM, Slava Pestov <spestov at apple.com> wrote:
> 
> 
> 
>> On Nov 28, 2017, at 1:35 PM, Matthew Johnson <matthew at anandabits.com <mailto:matthew at anandabits.com>> wrote:
>> 
>>>> * the compiler doesn’t have to reason about an overload set which might improve build times, etc
>>> 
>>> They’re effectively equivalent, because we still have to decide which subset of the default arguments apply at a given call site by checking all combinations of constraints.
>> 
>> Interesting.  Are there no advantages to the compiler that would be possible if an overload set was replaced with constrained default arguments?
>> 
> 
> Probably not. In general I’m wary of designing language features specifically to speed up the type checker, since they make not have the intended effect or even the opposite effect. We know the type checker implementation is not the best possible implementation of a type checker — there is a lot we can improve without changing the language.

That isn’t the motivation here.  I thought it might be an incidental benefit.  If it isn’t the motivating use case still stands.  Of course it may or may not be sufficient to justify the feature.  :)

> 
> Slava

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


More information about the swift-evolution mailing list