<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 28, 2016, at 9:45 PM, Paulo Faria <<a href="mailto:paulo@zewo.io" class="">paulo@zewo.io</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 28, 2016, at 3:34 PM, Matthew Johnson via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class=""><div class=""><div class="">Finally, I am very concerned that there are protocols such as Collection,<br class="">with many inferrable associated types, and that conforming to these<br class="">protocols could become *much* uglier.</div></div></blockquote></div></div></div></blockquote></div></blockquote></div><br class=""><div class="">Unfortunately I have a specific use case in which this argument would be very strong.</div><div class=""><br class=""></div><div class="">Basically this:</div><div class=""><br class=""></div><div class=""><div class="">extension TodoController : ResourceController {}</div><div class=""><br class=""></div><div class="">Would have to become this:</div><div class=""><br class=""></div><div class="">extension TodoController : ResourceController {</div><div class=""> public typealias CreateInput = Todo</div><div class=""> public typealias UpdateInput = Todo</div><div class=""><br class=""></div><div class=""> public typealias ListOutput = Todo</div><div class=""> public typealias CreateOutput = Todo</div><div class=""> public typealias DetailOutput = Todo</div><div class=""> public typealias UpdateOutput = Todo</div><div class=""><br class=""></div><div class=""> public typealias DetailID = String</div><div class=""> public typealias UpdateID = String</div><div class=""> public typealias DestroyID = String</div><div class="">}</div></div><div class=""><br class=""></div><div class="">I could reduce the amount of associated types but this would reduce the flexibility of the protocol by a huge factor and would make it much less powerful. I’m very torn about this because I do want generics to get better. Specifically I’m looking forward to conditional conformances. But this would be a too high cost imho. I know this is just one example. But maybe there are more examples like this out there. I have to admit this one really got to me. :(</div></div></div></blockquote></div><br class=""><div class=""><br class=""></div><div class="">Do these associated types have meaningful defaults? We’re not talking about eliminating the ability to have default types for associated types, e.g.,</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public protocol ResourceController {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> associatedtype CreateInput</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> associatedtype UpdateInput = CreateInput</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> associatedtype ListOutput</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> associatedtype CreateOutput = ListOutput</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> associatedtype DetailOutput = ListOutput</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> associatedtype UpdateOutput = ListOutput</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> associatedtype DetailID</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> associatedtype UpdateID = DetailID</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> associatedtype DestroyID = DetailID</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div class=""><br class=""></div><div class="">which might reduce the common case for conforming to the protocol to be, e.g.,</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>extension TodoController : ResourceController {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> public typealias CreateInput = Todo</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> public typealias ListOutput = Todo</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span> public typealias DetailID = String</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug</div><div class=""><br class=""></div></body></html>