Well, unless I'm mistaken, `()` here is a value. I can replace it with `3` and the compiler emits a warning about unused results. I'm guessing that since () is a value of type Void, the warning about unused results isn't triggered. While it's true that `Void` causes an error, I can write `Void()` instead and everything compiles just fine, which is what the `()` is doing too. Seems fine to me?
On Tue, Oct 11, 2016 at 1:43 PM, Erica Sadun via swift-evolution < [email protected]> wrote: > I thought this was long gone but today I found out it is still legal: > > switch i { > case 4 ... 6: () > case 3: print("Here") > default: break > } > > Is there a motivating factor for keeping this in the language? The > compiler picks up on Void and emits an error. You'd think () would produce > the same results but it doesn't. > > -- Erica > > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution > >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
