I have mixed feelings here, and I’m not keen on the specifics being proposed.
Commas are syntactically light-weight, and at the end of a line they are barely noticeable. This works both ways—on one hand, they are so minor that they are neither noisy nor distracting, so there’s no harm in keeping them. On the other hand, they don’t really add much visual information either, so it’s probably not a big loss if they go.
From a purely “clarity of reading” perspective, I don’t see much difference either way. Taking an example from the proposal, I think that aligning the colons in a function call provides a vastly greater benefit to readability than anything comma-related:
let config = TestConfig(
delim : "abc",
sampleTime : 42.0,
numIters : nil,
numSamples : nil,
quantile : nil,
delta : true,
verbose : false,
logMemory : true,
afterRunSleep : nil
)
This way it is much easier to see at a glance what values are being passed in which order, and it is *also* easier to locate any particular argument label since there is more space around them. By contrast, the presence or absence of trailing commas has a frankly negligible impact on readability.
• • •
If we were to allow commas to be omitted from lists, I would want to place some restrictions on when it can be done:
1. Consistency within a list
If any item in the list (other than the last) omits a trailing comma, then all items must omit them. Mixed lists would be a mess to untangle when reading code.
2. Single-line items only
If any item in the list spans more than one line, then the list must use trailing commas. We should not have to contend with multiline entries in a new-line delimited list. This solves the ambiguity problem by requiring commas in those cases.
• • •
I don’t have a strong opinion overall, except that a change of this nature should need to be found not only beneficial and desirable, but also non-harmful. We certainly don’t want to get in a situation where we accept something like this, only to later find out there were unforeseen problems that make us want to roll it back.
We’ve been through that once before with access control, and it would not be good to repeat such an exercise.