On Dec 21, 2015, at 1:08 PM, Dan Stenmark via swift-evolution 
<[email protected]> wrote:
> 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:
> 
> options NotSoSecretVariations {
>       case ProteinStyle,
>       case AnimalStyle,
>       case GrilledOnions,
>       ...
> }
> 
> 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.

We’ve definitely discussed it, at the same time we were designing the swift 2 
era syntax.

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.

-Chris

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to