[swift-evolution] Anoymous Enums (Updated)

Erica Sadun erica at ericasadun.com
Mon Feb 22 19:29:39 CST 2016


A few more off the top of my head. Any of these better?

func startService(type: [ client | server ]) { ... }
func pushNewContext(colorModel: [ rgba | rgb | grayscale ] ) { ... }
func animateDrawer(toState: [ closed | open | hidden ] ) { ... }
func startRecordingAudio(quality: [ q8k | q44k | q22k ] ) { ... }
func performAlert(type: [ slidein | pop | flip ] ) { ... }
func createPath(style: [ closed | open ] ) { ... }
func rectifyImage(standard: [ uikit | exif ]) { ... }

-- E


> On Feb 22, 2016, at 10:57 AM, David Waite <david at alkaline-solutions.com> wrote:
> 
> Then maybe low/medium/high is just a bad example?
> 
>> On Feb 22, 2016, at 10:35 AM, Erica Sadun <erica at ericasadun.com> wrote:
>> 
>> "An enumeration that's used in more than once place, has associated or raw values, or provides semantics beyond use as a flag is not a suitable candidate for this proposal."
>> 
>> I'd suggest that self-documenting flags are in and of themselves sufficiently useful.
>> 
>> -- E
> 



More information about the swift-evolution mailing list