Fair enough. I defer to both of you. Thanks, -- E
> On Oct 11, 2016, at 1:41 PM, Robert Widmann <[email protected]> wrote: > > I agree, though it may seem counterintuitive at first. () is a value of unit > type that exists here to satisfy the sema’s requirements that all branches > are destructive, productive or defer to another productive branch. > > ~Robert Widmann > >> On Oct 11, 2016, at 2:54 PM, Xiaodi Wu via swift-evolution >> <[email protected] <mailto:[email protected]>> wrote: >> >> 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] <mailto:[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] <mailto:[email protected]> >> https://lists.swift.org/mailman/listinfo/swift-evolution >> <https://lists.swift.org/mailman/listinfo/swift-evolution> >> >> >> _______________________________________________ >> swift-evolution mailing list >> [email protected] <mailto:[email protected]> >> https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
