Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Chris Lattner via swift-evolution <swift-evolution-m3FHrko0VLzYtjvyW6yDsg <at> public.gmane.org>
Subject: Re: [Review] SE-0084: Allow trailing commas in parameter lists and tuples
Newsgroups: gmane.comp.lang.swift.evolution
Date: Friday 13th May 2016 05:01:13 UTC (about 1 year ago)
On May 12, 2016, at 4:50 PM, Joe Groff  wrote:
>>> 	--- 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?
> 
> I wouldn't mind it.

I personally find that style repulsive :-) and I haven’t seen swift code
commonly doing it.  I’m not sure that we want to encourage it either.

> The standard library already uses this style for function parameters,
modulo the trailing comma, and I certainly prefer it to:
> 	
>> 	--- a.swift
>> 	+++ a.swift
>> 	 foo( x: 0
>> 	    , y: 1
>> 	+   , z: 2
>> 	    )

I agree that this is even worse, but I also haven’t seen this used in
Swift code.  Have you?   Swift’s strictness with argument labels makes
any of this pretty unappealing to use.

If we were really concerned about this, a narrower way to solve the same
problem would be to allow a comma before the ), but *only* when there is a
newline between them.  I still don’t see why we’d want to encourage
this though.

-Chris
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
 
CD: 3ms