[swift-evolution] Require parameter names for ENUM Associated Types?
Derrick Ho
wh1pch81n at gmail.com
Tue Nov 29 10:04:01 CST 2016
I like the idea of overloading an enum type. The issue happens when we use
it in a switch statements. Currently the parameters can be excluded.
However, We can make it a rule that any overloaded enum requires the full
signature.
On Tue, Nov 29, 2016 at 10:59 AM Adrian Zubarev via swift-evolution <
swift-evolution at swift.org> wrote:
> Hmm, I feel like default values wouldn’t work with overloaded enum cases.
>
> In my own project I have something like this:
>
> case javaScript(String)
> case scopedJavaScript(String, scope: Document)
>
> // But I'd like it to be:
> case javaScript(String)
> case javaScript(String, scope: Document)
>
>
>
> --
> Adrian Zubarev
> Sent with Airmail
>
> Am 29. November 2016 um 16:55:52, Charles Srstka (cocoadev at charlessoft.com)
> schrieb:
>
> On Nov 29, 2016, at 9:52 AM, Adrian Zubarev via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>
> 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.
>
> Or default values:
>
> enum MyEnum {
> case a
> case b(Int, string: String = “SomeDefault”)
> }
>
> Charles
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161129/697a42e5/attachment.html>
More information about the swift-evolution
mailing list