<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">As mentioned in my prior message, I currently have a PR open to update the generics manifesto (<a href="https://github.com/apple/swift/pull/13012" class="">https://github.com/apple/swift/pull/13012</a>). &nbsp;I removed one topic from that update at Doug Gregor’s request that it be discussed on the list first. &nbsp;</div><div class=""><br class=""></div><div class="">The idea is to add the ability to make default arguments conditional (i.e. depend on generic constraints). &nbsp;It is currently possible to emulate conditional default arguments using an overload set. &nbsp;This is verbose, especially when several arguments are involved. &nbsp;Here is an example use case using the overload method to emulate this feature:</div><div class=""><br class=""></div><div class="">```swift</div><div class="">protocol Resource {</div><div class="">&nbsp; associatedtype Configuration</div><div class="">&nbsp; associatedtype Action</div><div class="">}</div><div class="">struct ResourceDescription&lt;R: Resource&gt; {</div><div class="">&nbsp; func makeResource(with configuration: R.Configuration, actionHandler: @escaping (R.Action) -&gt; Void) -&gt; R {</div><div class="">&nbsp; &nbsp; // create a resource using the provided configuration</div><div class="">&nbsp; &nbsp; // connect the action handler</div><div class="">&nbsp; &nbsp; // return the resource</div><div class="">&nbsp; }</div><div class="">}</div><div class=""><br class=""></div><div class="">extension ResourceDescription where R.Configuration == Void {</div><div class="">&nbsp; func makeResource(actionHandler: @escaping (R.Action) -&gt; Void) -&gt; R {</div><div class="">&nbsp; &nbsp; return makeResource(with: (), actionHandler: actionHandler)</div><div class="">&nbsp; }</div><div class="">}</div><div class=""><br class=""></div><div class="">extension ResourceDescription where R.Action == Never {</div><div class="">&nbsp; func makeResource(with configuration: R.Configuration) -&gt; R {</div><div class="">&nbsp; &nbsp; return makeResource(with: configuration, actionHandler: { _ in })</div><div class="">&nbsp; }</div><div class="">}</div><div class=""><br class=""></div><div class="">extension ResourceDescription where R.Configuration == Void, R.Action == Never {</div><div class="">&nbsp; func makeResource() -&gt; R {</div><div class="">&nbsp; &nbsp; return makeResource(with: (), actionHandler: { _ in })</div><div class="">&nbsp; }</div><div class="">}</div><div class=""><br class=""></div><div class="">```</div><div class=""><br class=""></div><div class="">Adding language support for defining these more directly would eliminate a lot of boilerplate and reduce the need for overloads. &nbsp;Doug mentioned that it may also help simplify associated type inference (<a href="https://github.com/apple/swift/pull/13012#discussion_r152124535" class="">https://github.com/apple/swift/pull/13012#discussion_r152124535</a>).</div><div class=""><br class=""></div><div class="">The reason that I call this a pre-pitch and one reason Doug requested it be discussed on list is that I haven’t thought of a good way to express this syntactically. &nbsp;I am interested in hearing general feedback on the idea. &nbsp;I am also looking for syntax suggestions.</div><div class=""><br class=""></div><div class="">Matthew</div></body></html>