[swift-evolution] Could enums have their rawValue type inferred?

Tino Heth 2th at gmx.de
Tue May 17 09:10:52 CDT 2016


I'm not sure if I want the proposal to be standard-behavior, but in the past, I have written numerous extensions which basically took an enum to forward its raw value to an existing method (mostly keys for NSUserDefaults).
So, it would be convenient if the conversation happens automatically… but this use case isn't actually a "real" enum; it is just handy to get the value and a namespace for free, and I expect that there will be better ways to achieve this in the future.
On the other hand: What's the point of "raw-value enums"? Are they just a bridge-technogy, or is it ok to use them to store constants?


More information about the swift-evolution mailing list