Trailing Commas
Brian Goetz
brian.goetz at oracle.com
Thu Nov 30 22:10:04 UTC 2023
The bug evaluation raised two aspects of this:
- every change we made that "makes life easier for code generators"
makes life harder for parsers, and it is not clear that privileging one
over the other is a good idea;
- trailing comma support is intrinsically a bad idea, it is something
we sometimes hold our nose and tolerate, but should never like.
To these I will add:
- Trailing comma support in array initializers are almost surely a
"because C does it" (everything about array initializers was copied
too-literally from C); this was merely a bad reason in 1995, it is a
terrible reason today
- Array initializer context is "special" (compared to, say, method
argument lists) because arrays being initialized do not necessarily have
static arities, whereas method argument list definitely do. So even if
we tolerate it for array initializers, there is even less reason to
tolerate it in more highly structured contexts.
On 11/30/2023 2:02 PM, Ron Pressler wrote:
>
>> On 30 Nov 2023, at 00:22, Johannes Spangenberg<johannes.spangenberg at hotmail.de> wrote:
>>
>> Hello, I was curious about the potential consideration for extending support for trailing commas. While I don't consider them critical, I find myself regularly bothered that I cannot use them.
> Hi.
>
> Perhaps someone on the language team has already given the technical merits of this matter some thought, but here’s my non-technical argument against making such a change:
>
> For every person who has a strong preference in favour of allowing trailing commas where they’re not allowed today you’ll find another with an equally strong preference against allowing them. Additionally, if this option exists, people will want to write or update style guides preferring one style or the other. So the result is a lot of time, and possibly completely disproportionate emotion, spent for what, at best, is little gain. To me this sounds like the kind of change that is bound to require more effort — not on the implementation perhaps, but in debate — than it’s worth.
>
> — Ron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20231130/ed757b0b/attachment.htm>
More information about the amber-dev
mailing list