> On May 10, 2016, at 1:58 PM, Chris Lattner via swift-evolution > <[email protected]> wrote: > >> >> On May 10, 2016, at 12:36 PM, Tony Allevato <[email protected]> wrote: >> >> On Tue, May 10, 2016 at 11:53 AM Chris Lattner via swift-evolution >> <[email protected]> wrote: >> Hello Swift community, >> >> The review of "SE-0084: Allow trailing commas in parameter lists and tuples" >> begins now and runs through May 16. The proposal is available here: >> >> >> https://github.com/apple/swift-evolution/blob/master/proposals/0084-trailing-commas.md >> >> * What is your evaluation of the proposal? >> >> -1. It makes more sense to allow this for arrays and dictionaries because >> are variable-length collections whose literals are much more likely to grow >> as a code base evolves (anecdotal personal experience). Tuples are fixed >> arity, so proactively protecting oneself with a trailing comma seems like it >> would have minimal benefit when the surrounding code would have to change in >> other ways. >> >> Likewise for function calls; I would argue that if a function >> call/definition's parameter list is likely to grow so much and/or so >> frequently that a trailing comma provides significant savings, that's a code >> smell that should encourage the author to redesign the function. > > FWIW, I personally agree with this observation. > > Parameter lists and tuples are also structurally different than collections. > Parameter lists also have labels, and (depending on how the ‘disable > reordering default arguments’ decision goes) parameters may not be added and > reordered arbitrarily. Tuples are different because adding a member will > often break all the code downstream because it changes the type of the value. > This is different than array and dictionary literals.
A parameter list or tuple may have a specific arity and order at a point in time, but function signatures still evolve. > The only “collection like” aspect I can think of is for variadic parameter > lists, but I don’t think they’re common enough to provide a special case for. IMO, this is *already* a special case. It feels like an arbitrary inconsistency that some comma-separated lists admit trailing commas and some don't. I don't think users are thinking of a "structural difference" between collections and arguments when working with them, they just see the syntax. -Joe _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
