[swift-evolution] [draft] Compound Names For Enum Cases

David Hart david at hartbit.com
Tue Jan 24 01:13:03 CST 2017



> On 24 Jan 2017, at 00:52, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> 
> We're not terribly principled about this right now with non-pattern declaration references. You can still reference an unapplied function by its base name alone without its labels, if it's unambiguous:
> 
> func foo(x: Int, y: Int) {}
> 
> let foo_x_y: (Int, Int) -> () = foo
> 
> so it'd be consistent to continue to allow the same in pattern references.

WRT ambiguity, do we loose the ability to pattern match on the naked case name when two cases share the same base name?

enum Foo {
    case bar(a: Int)
    case bar(b: String)
}

switch aFoo {
    case .bar: // matches both cases
        break
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170124/469f2f6a/attachment.html>


More information about the swift-evolution mailing list