[swift-evolution] Allowing trailing commas in argument lists

Patrick Gili gili.patrick.r at gili-labs.com
Wed Mar 9 12:55:53 CST 2016


I have to agree with Ted. When I leave a "trailing comma", it's almost always because I constructing a call and didn't finish, for whatever reason. Thankfully, the compiler is nice enough to tell me when I committed this error.

Cheers,
-Patrick

> On Mar 9, 2016, at 9:44 AM, Ted F.A. van Gaalen via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hi Paul
> 
> I don’t think that is a good idea because:
> 
> as in most human languages writing,
> the comma tells us,
> that more is following,
> ?
> ?
> .. oops. hey, no more text?   
> 
> So, to me your examples are incomplete statements,
> leading to mistakes when editing, me assuming that I
> didn’t finish typing the statement, when I started
> editing the source say, three months later.
> or, doing maintenance and having to fast-read through
> many old source files.
> 
> Is it really so hard to press the DEL key to remove
> the trailing comma?
> 
> Greetings,
> TedvG ,
> 
> 
> 
> (sorry no more text here :0)
> 
> 
> 
> 
> 
> 
>> 
>> Right now, Swift argument lists are not permitted to contain trailing commas. To make multi-line calls easier, we propose allowing trailing commas in argument (and tuple) syntax:
>> 
>>   let person = Person(
>>      id: json['id'],
>>      name: json['name'],
>>      picture: Im2age(picture),
>>      friends: friends,
>>   )
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list