<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="">Do you know why it was never brought to a vote? <div class=""><br class=""></div><div class="">I seem to remember us having a pretty good consensus. I think we decided to punt on nested generics by just not allowing nesting in them yet (which would be compatible since that is what happens now too). Then we would have a second proposal to deal with generics/associated more carefully.<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 8, 2017, at 7:15 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">At least one fairly complete draft for allowing concrete types to be declared inside protocols was at some point a PR in the swift-evolution repo. Worth taking a look at.<br class=""><br class="">The chief source of complexity is in terms of how to refer to or capture types or members of the containing type or protocol. In the draft I remember, protocols could be nested inside types, and types could be nested inside protocols. Whether and how a protocol with associated type requirements inside a generic type inside another protocol with associated type requirements can refer to types or members of the outermost protocol gets quickly very convoluted; this requires careful design.<br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Sat, Jul 8, 2017 at 20:59 Jonathan Hull via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">The idea (at least for me) is to namespace the enum within the protocol, so that users of the protocol have everything neatly packaged. Right now I have to make a Separate “FoozleErrors” enum, which just feels messy.<div class=""><br class=""></div><div class="">I would really like to see us be able to nest Structs, Enums, and even other Protocols within a protocol, and it would just act as a namespace. Wil is right though, that if we can only have one, Enums give us the most bang for our buck. That is the case I run into most often. In addition to Error Enums, I also have a lot of places where protocol functions return a classification (as an enum), and it is cluttering the top-level namespace with things named “Foozle____".</div><div class=""><br class=""></div><div class="">It isn’t a huge issue (it doesn’t stop me from doing anything), but it is an annoyance that I run into all the time… I view the fact that Swift doesn’t support this as a bug.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jon<br class=""><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 8, 2017, at 6:10 PM, Akshay Hegde <<a href="mailto:akshay_hegde@me.com" target="_blank" class="">akshay_hegde@me.com</a>> wrote:</div><br class="m_-9067813258815646445Apple-interchange-newline"><div class=""><div style="word-wrap:break-word;line-break:after-white-space" class="">Wouldn’t the following work just as well for providing a namespace?<div class=""><br class=""></div><div class=""><span style="font-family:SFMono-Regular;font-size:12px" class="">struct Foozle {</span></div></div></div></blockquote></div></div></div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word;line-break:after-white-space" class=""><div class=""><br style="font-family:SFMono-Regular;font-size:12px" class=""> <span style="font-family:SFMono-Regular;font-size:12px" class="">enum Errors: Error {</span><br style="font-family:SFMono-Regular;font-size:12px" class=""> <span style="font-family:SFMono-Regular;font-size:12px" class="">case malformedFoozle</span><br style="font-family:SFMono-Regular;font-size:12px" class=""> <span style="font-family:SFMono-Regular;font-size:12px" class="">case tooManyFoozles</span><br style="font-family:SFMono-Regular;font-size:12px" class=""> <span style="font-family:SFMono-Regular;font-size:12px" class="">}</span><br style="font-family:SFMono-Regular;font-size:12px" class=""><font face="SFMono-Regular" class=""><span style="font-size:12px" class="">}</span></font></div></div></div></blockquote></div></div></div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word;line-break:after-white-space" class=""><div class=""></div><div class=""><div class=""></div></div><div class="">
<div dir="auto" style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class=""><br class="">~Akshay</div>
</div></div></div></blockquote></div></div></div></div></div></div><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap:break-word;line-break:after-white-space" class="">
<div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jul 8, 2017, at 17:24, Jonathan Hull via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><br class="m_-9067813258815646445Apple-interchange-newline"><div class=""><div class="">I *really* want this as well.<br class=""><br class="">I think there was a serious proposal to do this early in Swift 4. Not sure why it stalled, but I seem to remember it being technically possible.<br class=""><br class="">Thanks,<br class="">Jon<br class=""><br class=""><blockquote type="cite" class="">On Jul 8, 2017, at 4:21 PM, William Shipley via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">Does anyone know if there's some good tech reason to not allow, like:<br class=""><br class="">protocol Foozle {<br class=""><span class="m_-9067813258815646445Apple-tab-span" style="white-space:pre-wrap">        </span>enum Errors: Error {<br class=""><span class="m_-9067813258815646445Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-9067813258815646445Apple-tab-span" style="white-space:pre-wrap">        </span>case malformedFoozle<br class=""><span class="m_-9067813258815646445Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_-9067813258815646445Apple-tab-span" style="white-space:pre-wrap">        </span>case tooManyFoozles<br class=""><span class="m_-9067813258815646445Apple-tab-span" style="white-space:pre-wrap">        </span>}<br class="">}<br class=""><br class="">Like, to me all this is doing is giving “Errors” a nice namespace, but the compiler might have other thoughts.<br class=""><br class="">-W<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></blockquote><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div></div></div></div></div></div>_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></div></body></html>