[swift-evolution] Pre-proposal: CaseEnumerable protocol (derived collection of enum cases)

davesweeris at mac.com davesweeris at mac.com
Wed Jan 20 17:24:25 CST 2016


Off the top of my head?
enum NumClassification {
	case None(Int)
	case Even(Int)
	case Odd(Int)
	case Prime(Int)
	case Negative(Int)
	case Positive(Int) //Always gotta end on a positive note :-)
}

Although I must admit, if there’s a purpose to CaseEnumerable (or whatever it’s being called now) beyond just automatically getting a static cases:[Self] and labels:[String], I’ve missed the memo about it.

- Dave Sweeris

> On Jan 20, 2016, at 15:18, Joe Groff <jgroff at apple.com> wrote:
> 
> 
>> On Jan 20, 2016, at 3:13 PM, David Sweeris <davesweeris at mac.com> wrote:
>> 
>> If the associated values are all enums themselves, that's great. What if your enum is an error type, and the associated values are all strings with maybe diagnostic info or time stamps or something?
> 
> Then I don't even know what you would use CaseEnumerable for. Do you have a more concrete use case in mind?
> 
> -Joe



More information about the swift-evolution mailing list