> On May 31, 2016, at 3:20 PM, Brent Royal-Gordon <[email protected]> 
> wrote:
> 
>> func scaleAndCropImage(
>>    image: UIImage,
>>    toSize size: CGSize,
>>    operation: (.Fit | .Fill) = .Fit
>>    ) -> UIImage {
> 
> As I said the last time this proposal came up, I think this is great right up 
> until the moment you need `operation` to be computed or kept in a variable. 
> Then you need to start copying your anonymous enum type all over your source, 
> and there's no central place to make changes. The same thing is true of 
> tuples, but tuples are easy to structure and destructure from individual 
> values on the spot; anonymous enums aren't really like that.

And the obvious answer is you can have up to 255 of these babies for the 
anonymous enum type, and be able to pass numerical equivalents UInt8 with 
compile time substitution. That the ad-hoc enumeration is basically a syntactic 
shorthand for UInt8, with an enforced upper bound compile time check simplifies 
everything including switch statements.

-- E

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to