<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="">This feature keeps being brought up. <a href="https://bugs.swift.org/browse/SR-3050" class="">SR-3050</a> and <a href="rdar://problem/28952398" style="font-family: Arial, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255);" class="">rdar://problem/28952398</a><span style="color: rgb(59, 115, 175); font-family: Arial, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255);" class=""> </span>are tracking it, as well as <a href="https://github.com/apple/swift-evolution/pull/114" class="">this Evolution proposal by Jacob</a>. The implementation has been discussed multiple times on social media (<a href="https://twitter.com/jtbandes/status/834633693138350080" class="">one example that comes to mind</a>). At this point it’s just a matter of sitting down to flesh out the implementation and seeing its consequences on Swift code, which we now have ample time to do because this feature is not in scope for Swift 4.</div><div class=""><span style="color: rgb(59, 115, 175); font-family: Arial, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class="">~Robert Widmann</div><div class=""><span style="color: rgb(59, 115, 175); font-family: Arial, sans-serif; font-size: 14px; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div><blockquote type="cite" class=""><div class="">On Mar 10, 2017, at 1:15 PM, Trevör ANNE DENISE 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=""><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="">Hello everyone,<div class=""><div class=""><br class=""></div><div class="">As I was writing a program, I realised that I could make it safer by being able to list all possible cases of a Swift enum.</div><div class="">This is similar to what has been described there:</div><div class=""><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/001233.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/001233.html</a></div><div class=""><br class=""></div><div class="">Is there any updates about it since 2015?</div></div><div class=""><br class=""></div><div class="">Also, do you think this would be a good idea to make extensions constrainable by enum types, like that?</div><div class="">extension Type where P1: enum {</div><div class="">}</div><div class=""><br class=""></div><div class="">You could then write something similar to this:</div><div class=""><br class=""></div><div class="">protocol A {</div><div class="">associatedtype P1</div><div class="">associatedtype P2</div><div class="">static var p1PossibleValues:[P1] { get }</div><div class="">static var p2PossibleValues:[P2] { get }</div><div class="">}</div><div class=""><br class=""></div><div class="">extension A where P1: enum, P2: enum {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>static var p1PossibleValues:[P1] { return p1PossibleValues.allValues }</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>static var p2PossibleValues:[P2] { return p2PossibleValues.allValues }</div><div class="">}</div><div class=""><br class=""></div><div class="">Would it make sense to do it this way?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Trevör</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>