[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Trailing commas in argument & parameter lists patch
- From: Frank Mitchell <frank_mitchell_us@...>
- Date: Wed, 1 Mar 2023 18:12:42 +0000 (UTC)
On Wednesday, March 1, 2023 at 09:22:23 AM CST, Steven Hall <shallnot@live.ca> wrote:
> Perhaps removing the ability for table definitions to allow a final comma is the thing
> that needs to be changed to make things consistent?
Table constructors get edited all the time, and they can get huge, especially when people use Lua as a data format. A trailing comma or even semicolon shouldn't keep the script from running, or invalidate a whole data set. If there's an extra key in a table it will be ignored. If there's a missing key, it *may* not make a difference; a robust app will either fill it in or ask politely for assistance even as it accepts the records without errors.
On the other hand, function parameter lists are (usually) short, and a trailing comma *might* indicate that something was deleted that shouldn't have been. Code requires greater scrutiny. Maybe languages shouldn't have begun using delimiters at all -- whitespace is good enough for Lisp -- but now that we have them let's use the redundancy to make sure our dynamically typed languages aren't running off in the wrong direction with a pair of scissors (to mix metaphors).
On the third hand, I'm a big fan of _stare decisis_ - let the (prior) decision stand. A.k.a. if it ain't broke, don't fix it. Someone cited Emerson's line about "foolish consistency"? This concern may not be foolish, but it's, well, an unnecessary risk to change syntactic rules that nobody's really stumbled over before now.
Frank Mitchell