<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 Apr 24, 2017, at 3:21 PM, Kevin Nattinger <<a href="mailto:swift@nattinger.net" class="">swift@nattinger.net</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 Apr 24, 2017, at 3:16 PM, Jaden Geller <<a href="mailto:jaden.geller@gmail.com" class="">jaden.geller@gmail.com</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 Apr 24, 2017, at 2:38 PM, Kevin Nattinger <<a href="mailto:swift@nattinger.net" class="">swift@nattinger.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><br class=""></div><div class="">How can I improve your understanding?</div><br class=""></div></div></blockquote></div><div class=""><br class=""></div>Given the enum I was using earlier:<div class=""><br class=""><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">enum</span><span style="font-variant-ligatures: no-common-ligatures" class=""> Thing {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> thingOne<T>(T)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">case</span><span style="font-variant-ligatures: no-common-ligatures" class=""> thingTwo<T>(T)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">}</span></div></div><div class=""><br class=""></div><div class="">- Write a function that takes a <span style="font-family: Menlo; font-size: 11px;" class="">thingOne<String> </span>or<span style="font-family: Menlo; font-size: 11px;" class=""> </span><span style="font-family: Menlo; font-size: 11px;" class="">thingTwo<Int> </span>but nothing else.</div></div></div></div></blockquote><div class=""><br class=""></div><div class="">This isn’t possible since generic types introduced on cases are erased in the type of `Thing`.</div><div class=""><br class=""></div><div class="">We can actually already achieve what you want by moving the generics onto the type itself, and this is already possible in Swift! No new features are necessary.</div><div class=""><br class=""></div><div class="">```</div><div class=""><div style="margin: 0px 0px 0px 31.5px; text-indent: -31.6px; line-height: normal; font-family: Monaco; font-size: 11px;" class=""><span style="color: rgb(201, 0, 164);" class="">enum</span> Thing<span style="color: rgb(200, 0, 164);" class=""><</span>T1, T2<span style="color: rgb(200, 0, 164);" class="">></span> {</div><div style="margin: 0px 0px 0px 63px; text-indent: -63.1px; line-height: normal; font-family: Monaco; font-size: 11px;" class=""> <span style="color: rgb(200, 0, 164);" class="">case</span> thingOne(T1)</div><div style="margin: 0px 0px 0px 63px; text-indent: -63.1px; line-height: normal; font-family: Monaco; font-size: 11px;" class=""> <span style="color: rgb(200, 0, 164);" class="">case</span> thingTwo(T2)</div><div style="margin: 0px 0px 0px 31.5px; text-indent: -31.6px; line-height: normal; font-family: Monaco; font-size: 11px;" class="">}</div><div style="margin: 0px 0px 0px 31.5px; text-indent: -31.6px; line-height: normal; font-family: Monaco; min-height: 17px; font-size: 11px;" class=""><br class=""></div><div style="margin: 0px 0px 0px 31.5px; text-indent: -31.6px; line-height: normal; font-family: Monaco; font-size: 11px;" class=""><span style="color: rgb(201, 0, 164);" class="">func</span> test(_ x: Thing<span style="color: rgb(200, 0, 164);" class=""><</span><span style="color: rgb(121, 14, 173);" class="">String</span>, <span style="color: rgb(121, 14, 173);" class="">Int</span><span style="color: rgb(200, 0, 164);" class="">></span>) {</div><div style="margin: 0px 0px 0px 63px; text-indent: -63.1px; line-height: normal; font-family: Monaco; font-size: 11px;" class=""> <span style="color: rgb(200, 0, 164);" class="">switch</span> x {</div><div style="margin: 0px 0px 0px 63px; text-indent: -63.1px; line-height: normal; font-family: Monaco; font-size: 11px;" class=""> <span style="color: rgb(200, 0, 164);" class="">case</span> <span style="color: rgb(200, 0, 164);" class="">.</span>thingOne(<span style="color: rgb(201, 0, 164);" class="">let</span> s):</div><div style="margin: 0px 0px 0px 94.6px; text-indent: -94.7px; line-height: normal; font-family: Monaco; color: rgb(223, 0, 2); font-size: 11px;" class=""><span style="" class=""> </span><span style="color: rgb(69, 0, 132);" class="">print</span><span style="" class="">(</span>"The string has value \(s)!"<span style="" class="">)</span></div><div style="margin: 0px 0px 0px 63px; text-indent: -63.1px; line-height: normal; font-family: Monaco; font-size: 11px;" class=""> <span style="color: rgb(200, 0, 164);" class="">case</span> <span style="color: rgb(200, 0, 164);" class="">.</span>thingTwo(<span style="color: rgb(201, 0, 164);" class="">let</span> i):</div><div style="margin: 0px 0px 0px 94.6px; text-indent: -94.7px; line-height: normal; font-family: Monaco; color: rgb(223, 0, 2); font-size: 11px;" class=""><span style="" class=""> </span><span style="color: rgb(69, 0, 132);" class="">print</span><span style="" class="">(</span>"The int has value \(i)!"<span style="" class="">)</span></div><div style="margin: 0px 0px 0px 63px; text-indent: -63.1px; line-height: normal; font-family: Monaco; font-size: 11px;" class=""> }</div><div style="margin: 0px 0px 0px 31.5px; text-indent: -31.6px; line-height: normal; font-family: Monaco; font-size: 11px;" class="">}</div></div><div class="">```</div></div></div></div></blockquote><div class=""><br class=""></div>Yes, that was almost exactly my original example. My understanding of the proposal is that it will remove that capability, which I find completely unacceptable.</div><div class=""><br class=""></div></div></div></blockquote><br class=""></div><div>Hi Kevin,</div><div><br class=""></div><div>If that is what is being proposed, I agree that that is entirely unacceptable. I however did not understand the proposal to be removing that capability, but instead I understood that it was simply adding another. That is, `Thing<T1, T2>` would *still* be accepted. This feature is entirely additive.</div><div><br class=""></div><div>It would be great if the original proposal author could confirm this.</div><div><br class=""></div><div>Thanks,</div><div>Jaden Geller</div><br class=""></body></html>