[swift-evolution] [swift-dev] Re-pitch: Deriving collections of enum cases

Martin Waitz tali at admingilde.org
Wed Jan 10 02:15:05 CST 2018


Hello Brent,

> Am 10.01.2018 um 06:15 schrieb Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org>:
> 
> For what it's worth, I *might* introduce a follow-up proposal with conformances for Bool and Optional. Their straightforwardness and utility make them very tempting.

A conditional conformance for Optional could in fact be useful, but what’s the use-case for Bool?
If somebody needs a Bool conformance for generic code, it’s extremely simple to just define conformance herself.
If we see that people really do need Bool conformance, we can still add it at any time.

> (The only questions are whether `false` and `nil` should be first or last. But if the default isn't right for your use case, you can always make your own static property instead of using the standard library's.)

I would start with the default initialiser.

— Martin


More information about the swift-evolution mailing list