[swift-evolution] [Pitch] Numeric enum cases

Adrian Zubarev adrian.zubarev at devandartist.com
Tue Nov 22 07:41:28 CST 2016

Have we already discussed this somewhere?

enum MyEnum {
    case 0
    case 1(String)

// or

enum MyEnum {
    case `0`
    case `1`(String)

let zero: MyEnum = .0
let one = MyEnum.1("Swift")

switch zero {
case .0:

case .1(let string)  

Tuples have this .# syntax, where the number is the index of the tuple value. Can’t we allow this on enum cases as well?

This is additive and something for phase 2, but I’d like to know if we want to allow this?! :)

Adrian Zubarev
Sent with Airmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161122/bb906fc7/attachment.html>

More information about the swift-evolution mailing list