[swift-evolution] [Review] SE-0084: Allow trailing commas in parameter lists and tuples

Chris Lattner clattner at apple.com
Thu May 12 18:47:11 CDT 2016


On May 11, 2016, at 9:47 AM, Joe Groff <jgroff at apple.com> wrote:
> +1 from me. We should be consistent in either accepting or rejecting trailing commas everywhere we have comma-delimited syntax. I'm in favor of accepting it, since it's popular in languages where it's supported to enable a minimal-diff style, so that changes to code don't impact neighboring lines for purely syntactic reasons. If you add an argument to a function, without trailing comma support, a comma has to be added to dirty the previous line:
> 
> 	--- a.swift
> 	+++ a.swift
> 	 foo(
> 	   x: 0,
> 	-  y: 1
> 	+  y: 1,
> 	+  z: 2
> 	 )
> 
> Trailing commas avoid this:
> 
> 	--- a.swift
> 	+++ a.swift
> 	 foo(
> 	   x: 0,
> 	   y: 1,
> 	+  z: 2,
> 	 )

You’re arguing that you want to read Swift code written like this?

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160512/f42bac8c/attachment.html>


More information about the swift-evolution mailing list