> On Oct 12, 2016, at 12:32 PM, Kevin Nattinger via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> or more like a body (some different options for syntax, pick one obviously):
> enum Size {
>       let height: Int
>       let width: Int
>       case small {
>               height = 30
>               width = 30
>       }
>       case medium: {
>               .height = 60
>               .width = 60
>       }
>       case large = {
>               let height = 120
>               let width = 120
>       }
> }

I sort of prefer to have a protocol-like syntax for declaring the properties, 
instead of let, because we’re doing something similar to what protocols do: 
we’re promising that each of these things will provide the property, although 
they might do it in different ways. This also avoids the connotation we have 
with “let” that the property will be a constant, when in actuality it may be 
dynamically computed and thus there is the possibility for it to be different 
each time.

Charles

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to