[swift-evolution] A native option set construct

Dan Stenmark daniel.j.stenmark at gmail.com
Mon Dec 21 15:08:56 CST 2015


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.

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151221/65496c1b/attachment.html>


More information about the swift-evolution mailing list