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

Evan Maloney emaloney at gilt.com
Wed May 11 10:08:51 CDT 2016


> * What is your evaluation of the proposal?

-1. 

It feels wrong to allow garbage syntax lying around in one's code simply for the sake of occasional convenience. It's like littering on the sidewalk because it's easier than throwing something in a trash can.

Because commas are allowed in several places, and because there is no consistent way to allow a trailing commas throughout the language without allowing at least some scenarios in which a trailing comma would change the meaning of the code, it is not safe for the Swift compiler to assume that a trailing comma is intentional and not a mistake. Doing so would shift a compile-time error to runtime.

> * Is the problem being addressed significant enough to warrant a change to Swift?

No. Not terminating a list with a comma is about as much of a "problem" as having to terminate strings with a quote.

> * Does this proposal fit well with the feel and direction of Swift?

Making Swift more forgiving of bad syntax does not feel very Swifty to me.

Allowing trailing commas everywhere comma separation is used would be consistent, but would make Swift less strict and less safe. Allowing trailing commas only in those places where they could not possibly affect runtime behavior would be safer, but would make the language less consistent. Either option is sub-optimal.

> * If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

I've never used the feature in any other language, because I don't find trailing commas visually appealing. They make the code look the developer forgot to finish working on it.



More information about the swift-evolution mailing list