[swift-evolution] Ad hoc enums / options

Ricardo Parada rparada at mac.com
Wed Jun 1 20:48:36 CDT 2016


> On May 31, 2016, at 3:04 PM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
> 
> let _ = scaleAndCropImage(image: myImage, toSize: size, operation: .fill)
> 
> You would not be able to assign `.fill` to a variable and use that for the operation value.

This is my objection to this idea. It does not encourage reuse. 

I would not be able to assign to a variable:

let selectedOperation = .fill

In order to then do this later in the program:

scaleAndCropImage(image: myImage, toSize: size, operation: selectedOperation)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160601/ba6c8038/attachment.html>


More information about the swift-evolution mailing list