<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="">On Dec 21, 2015, at 1:08 PM, Dan Stenmark via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<div><blockquote type="cite" class=""><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="">One of the things that surprised me is that there still isn’t concise syntax for creating option sets, a pattern I see out in the wild a fair bit. While Swift 2 did introduce OptionSetType for structs, it still feels somewhat obtuse and non-obvious. It would be great if we could something like:<div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: 'Courier New';" class="">options NotSoSecretVariations {</div><div style="margin: 0px; line-height: normal; font-family: 'Courier New';" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case ProteinStyle,</div><div style="margin: 0px; line-height: normal; font-family: 'Courier New';" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case AnimalStyle,</div><div style="margin: 0px; line-height: normal; font-family: 'Courier New';" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case GrilledOnions,</div><div style="margin: 0px; line-height: normal; font-family: 'Courier New';" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>...</div><div style="margin: 0px; line-height: normal; font-family: 'Courier New';" class="">}</div></div><div class=""><br class=""></div><div class="">That said, I have a feeling this isn’t the first time the Swift team has come across a pitch like this. If this really is unfeasible, it would be great and really educational to hear what the challenges are.</div></div></div></blockquote><br class=""></div><div>We’ve definitely discussed it, at the same time we were designing the swift 2 era syntax.</div><div><br class=""></div><div>The consensus from those discussions is that option sets are set-like and sets don’t/shouldn't have privileged declaration syntax. Instead of adding complexity to the core language for this, we’d rather eventually cover this with a hygienic macro system some day. That would allow option sets to remain a library feature.</div><div><br class=""></div><div>-Chris</div><br class=""></body></html>