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

Brent Royal-Gordon brent at architechies.com
Tue Jan 9 23:15:26 CST 2018


> On Jan 8, 2018, at 11:02 AM, Robert Widmann via swift-evolution <swift-evolution at swift.org> wrote:
> 
> As you note, integral types and Bool and some enums that fall outside the scope of the synthesis requirements fit this mold quite nicely.  We do not include them in the proposal partially to keep things simple, partially because we’d be stepping on Range’s toes, and partially because synthesis for structs is tricky in the general case.  If deemed particularly useful in the future, these conformance can be added.


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.

(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.)

-- 
Brent Royal-Gordon
Architechies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20180109/0941a77c/attachment.html>


More information about the swift-evolution mailing list