I just showed a direction of what could be possible.
Personally I think it would be enough if we had this:
enum MyEnum {
case a
case b(Int)
case b(Int, string: String)
}
Where .b can be overloaded by it’s associated types.
--
Adrian Zubarev
Sent with Airmail
Am 29. November 2016 um 16:48:34, Karl ([email protected]) schrieb:
On 29 Nov 2016, at 14:55, Adrian Zubarev via swift-evolution
<[email protected]> 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
I think this is a side effect of this proposal
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
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution