Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-13 Thread Erica Sadun via swift-evolution
> On Oct 13, 2016, at 9:31 AM, Chris Lattner via swift-evolution > wrote: > >> >> On Oct 13, 2016, at 4:26 AM, Alex Blewitt via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> On 13 Oct 2016, at 11:06, Haravikk via swift-evolution >> mailto:swift-evolution@swift.org>> wro

Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-13 Thread Haravikk via swift-evolution
> On 13 Oct 2016, at 16:19, Nevin Brackett-Rozinsky via swift-evolution > wrote: > > If I might be so bold, perhaps we should consider the opposite. Suppose you > have a conditional statement inside a loop. It would be easier for the reader > to understand what it does if “break” meant the sa

Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-13 Thread Chris Lattner via swift-evolution
> On Oct 13, 2016, at 4:26 AM, Alex Blewitt via swift-evolution > wrote: > > On 13 Oct 2016, at 11:06, Haravikk via swift-evolution > mailto:swift-evolution@swift.org>> wrote: >> >>> >>> On 11 Oct 2016, at 19:43, Erica Sadun via swift-evolution >>> mailto:swift-evolution@swift.org>> wrote:

Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-13 Thread Nevin Brackett-Rozinsky via swift-evolution
If I might be so bold, perhaps we should consider the opposite. Suppose you have a conditional statement inside a loop. It would be easier for the reader to understand what it does if “break” meant the same thing regardless of whether you used “if” or “switch” for the condition. Right now, these t

Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-13 Thread Haravikk via swift-evolution
> On 13 Oct 2016, at 12:26, Alex Blewitt wrote: > > On 13 Oct 2016, at 11:06, Haravikk via swift-evolution > mailto:swift-evolution@swift.org>> wrote: >> >>> >>> On 11 Oct 2016, at 19:43, Erica Sadun via swift-evolution >>> mailto:swift-evolution@swift.org>> wrote: >>> >>> I thought this wa

Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-13 Thread Alex Blewitt via swift-evolution
On 13 Oct 2016, at 11:06, Haravikk via swift-evolution wrote: > >> >> On 11 Oct 2016, at 19:43, Erica Sadun via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> I thought this was long gone but today I found out it is still legal: >> >> switch i { >> case 4 ... 6: () >> cas

Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-13 Thread Haravikk via swift-evolution
> On 11 Oct 2016, at 19:43, Erica Sadun via swift-evolution > 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

Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-11 Thread Erica Sadun via swift-evolution
Fair enough. I defer to both of you. Thanks, -- E > On Oct 11, 2016, at 1:41 PM, Robert Widmann 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 o

Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-11 Thread Robert Widmann via swift-evolution
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-evolutio

Re: [swift-evolution] Pitch: disallow `()` from Switch statement case satisfaction

2016-10-11 Thread Xiaodi Wu via swift-evolution
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()` i