Re: [swift-evolution] commas optional

2017-10-15 Thread Mike Kluev via swift-evolution
On 16 October 2017 at 01:20, Dave Yost wrote: > Nuance: > > Compiler says: > Expression following ‘return’ is treated as an argument of the 'return > '. > unless foo() is indented by at least one space. Then there is no > complaint. > to have more fun try this: return

Re: [swift-evolution] commas optional

2017-10-15 Thread Dave Yost via swift-evolution
Nuance: Compiler says: Expression following ‘return’ is treated as an argument of the 'return'. unless foo() is indented by at least one space. Then there is no complaint. > On 2017-10-15, at 4:32 PM, Dave Yost wrote: > > Very cool! > > func foo() -> Int { return 17 } > >

Re: [swift-evolution] commas optional

2017-10-15 Thread Dave Yost via swift-evolution
Very cool! func foo() -> Int { return 17 } func bug1() -> Int { return foo() // Compiler says: Expression following ‘return' //is treated as an argument of the 'return'. } var x = 0 func bug2() { return x = 4 // not even a warning – should be an error }

Re: [swift-evolution] commas optional

2017-10-15 Thread Mike Kluev via swift-evolution
on Date: Fri, 13 Oct 2017 20:21:22 -0700 Chris Lattner wrote: We already have whitespace sensitive rules to handle this. There is no > fundamental implementation difference that I see between separating the > elements of lists (which are expressions) and the elements of

Re: [swift-evolution] commas optional

2017-10-13 Thread Chris Lattner via swift-evolution
> On Oct 13, 2017, at 10:43 AM, Jarod Long via swift-evolution > wrote: > > Ahh, yeah, that does seem like a much trickier case to avoid breaking. My > instinct says it's still possible to avoid, but maybe not without lots of > complexity. We already have

Re: [swift-evolution] commas optional

2017-10-13 Thread Jarod Long via swift-evolution
Ahh, yeah, that does seem like a much trickier case to avoid breaking. My instinct says it's still possible to avoid, but maybe not without lots of complexity. Jarod On Oct 12, 2017, 16:21 -0700, Xiaodi Wu , wrote: > On Thu, Oct 12, 2017 at 2:47 PM, Jarod Long via

Re: [swift-evolution] commas optional

2017-10-12 Thread Chris Lattner via swift-evolution
Hi Dave, I agree with you that this is an analogous technical problem to semicolon inference, and that Swift has a well developed solution for it which would probably work well enough. That said, this is a pure sugar proposal, one which can make future evolution more difficult. Getting this

Re: [swift-evolution] commas optional

2017-10-12 Thread Kelvin Ma via swift-evolution
On Thu, Oct 12, 2017 at 6:20 PM, Xiaodi Wu wrote: > On Thu, Oct 12, 2017 at 2:47 PM, Jarod Long via swift-evolution < > swift-evolution@swift.org> wrote: > >> I don't really expect this sort of syntactic sugar to be popular enough >> to make it through swift-evolution, and I

Re: [swift-evolution] commas optional

2017-10-12 Thread Xiaodi Wu via swift-evolution
On Thu, Oct 12, 2017 at 2:47 PM, Jarod Long via swift-evolution < swift-evolution@swift.org> wrote: > I don't really expect this sort of syntactic sugar to be popular enough to > make it through swift-evolution, and I don't think it's worth the > distraction from more important priorities at this

Re: [swift-evolution] commas optional

2017-10-12 Thread Dave Yost via swift-evolution
> On 2017-10-12, at 12:03 PM, Xiaodi Wu wrote: > > Single elements can legally span multiple lines; this would be hugely source > breaking. What problem are you trying to solve? The same problem that is solved by the precedent of semicolons being optional (clutter). I

Re: [swift-evolution] commas optional

2017-10-12 Thread Jarod Long via swift-evolution
I don't really expect this sort of syntactic sugar to be popular enough to make it through swift-evolution, and I don't think it's worth the distraction from more important priorities at this time, but for what it's worth, I've enjoyed this feature in other languages that support it. It plays a

Re: [swift-evolution] commas optional

2017-10-12 Thread Josh Parmenter via swift-evolution
On Oct 12, 2017, at 12:17 PM, Kelvin Ma via swift-evolution > wrote: a semicolon is a purely syntactic delimiter, the comma on the other hand corresponds to physical elements in a collection. I think the two are more different than

Re: [swift-evolution] commas optional

2017-10-12 Thread Kelvin Ma via swift-evolution
a semicolon is a purely syntactic delimiter, the comma on the other hand corresponds to physical elements in a collection. I think the two are more different than you suggest. On Thu, Oct 12, 2017 at 1:50 PM, Dave Yost via swift-evolution < swift-evolution@swift.org> wrote: > > Speaking as a

Re: [swift-evolution] commas optional

2017-10-12 Thread Xiaodi Wu via swift-evolution
Single elements can legally span multiple lines; this would be hugely source breaking. What problem are you trying to solve? On Thu, Oct 12, 2017 at 13:50 Dave Yost via swift-evolution < swift-evolution@swift.org> wrote: > > Speaking as a huge fan of optional semicolons... > > > This seems

[swift-evolution] commas optional

2017-10-12 Thread Dave Yost via swift-evolution
Speaking as a huge fan of optional semicolons... This seems clear: semicolon : sequence of statements :: comma : sequence of elements in an array literal and so it occurred to me that this should hold: A semicolon : the last statement on a line. :: A comma : the