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 into Swift 5 will be very very difficult to 
justify, even if the community somehow agreed that it was the right thing to 
do.  It is just the conservatively correct default to say “no” to these sorts 
of changes now, because there are other bigger moving pieces that have to be 
sorted first.

-Chris



> On Oct 12, 2017, at 11:50 AM, Dave Yost via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> 
> 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 last array element on a line.
> 
>   ∴  A comma after the last array element on a line should be optional.
> 
> and these should be legal Swift:
> 
>   let list = [
>       1
>       2
>   ]
> 
>   let dict = [
>       1 : 2
>       2 : 3
>   ]
> 
> equivalent to:
> 
>   let list = [ 1, 2 ] ; let dict = [ 1 : 2, 2 : 3 ]
> 
> 
> Or, as the Language Reference would say:
> 
> A semicolon (;) can optionally appear after any statement and is used to 
> separate multiple statements if they appear on the same line.
> 
> A comma (,) can optionally appear after any element of an array literal and 
> is used to separate multiple elements if they appear on the same line.
> 
> Or:
> 
> A semicolon (;) separates statements but is optional after the last statement 
> on a line.
> 
> A comma (,) separates elements of an array literal but is optional after the 
> last element on a line.
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to