SE-0257: Eliding commas from multiline expression lists

  • What is your evaluation of the proposal?

+1, assuming there are no harsh impacts on tooling quality or syntactic directions for the language.

From the most recent pitch thread (which I couldn't find the link for in the proposal though it has links to previous pitches):

IIUC, the parsing behavior is the same for the exceptional cases and if you want listing behavior you add a comma, which current code has.

The proposal mentions that we could offer a fixit if member lookup fails in a context where multiple values are expected. I know this is a nitty detail, but @nate_chandler, do you know how hard it would be to add this? Are we expecting this to be part of the implementation or follow soon after? IIUC, diagnostics for the other direction (i.e. commas need to be removed) are not as relevant.

@Douglas_Gregor, is the proposed diagnostic the same as what you're thinking of, or are you talking about something different or more general here?

By "a lot closer", are you referring to the syntactic impacts of this feature or the use cases? Are you able to address some of the concerns regarding parsing performance and poor diagnostics?

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

I feel so. I've always wanted to elide these commas in lists of generics, labeled parameter lists, dictionary literals, etc.

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

I think this will make Swift a better language for DSLs, configurations, and other places where long declarations exist.

  • If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

Haskell, which has far fewer commas and parenthesis, making it a nice host language for EDSLs.

  • How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

In-depth study of use cases, but not of the implementation or grammar impact.

2 Likes