[swift-evolution] Ad hoc enums / options

Vladimir.S svabox at gmail.com
Tue May 31 11:52:54 CDT 2016


IMO interesting idea.. We have ad hoc structs as tuples and it seems like 
ad-hoc enums also could be helpful when we don't need a separate class for 
using in limited scope.

I also can see advantage to use such anonymous enum type in code:

var codePath : (.one | .two | .three) = .one

...

switch codePath {
   case .one : ...
   case .two : ...
   case .three : ...
}

IMO very clean and expressive code and I like the proposed syntax.
So I'd like to have such in Swift

On 31.05.2016 19:16, Erica Sadun via swift-evolution wrote:
> func scaleAndCropImage(
> 	image: UIImage,
> 	toSize size: CGSize,
> 	*operation: (.Fit | .Fill) = .Fit*
> 	) -> UIImage {
>
>


More information about the swift-evolution mailing list