[swift-evolution] Require parameter names for ENUM Associated Types?

Karl razielim at gmail.com
Tue Nov 29 09:48:32 CST 2016


> On 29 Nov 2016, at 14:55, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I’d rather would have the ability of overloading enum cases:
> 
> enum MyEnum {
>      
>     case a
>     case a(Int)
>     case a(label: Int)
>     case a(Double)
> }
> I don’t know how enums work internally, but I spotted a bug recently where the compiler does not allow to declare a function with the same name as an enum case.
> 
> SR–3256 <https://bugs.swift.org/browse/SR-3256>
> I think this is a side effect of this proposal https://github.com/apple/swift-evolution/blob/master/proposals/0036-enum-dot.md <https://github.com/apple/swift-evolution/blob/master/proposals/0036-enum-dot.md>
> 

eek… I really would not like that at all.

if case .a(let value) = myEnumValue {
    // what is type(of: value)?
}

- Karl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161129/6cbff310/attachment.html>


More information about the swift-evolution mailing list