3 ms·
I like Go’s solution: mandatory trailing commas. Doesn’t work for set-in-stone sql, sadly.
by sneak 7y ago
I like Go’s solution: mandatory trailing commas. Doesn’t work for set-in-stone sql, sadly.
- DannyB2 7y agoJava, in a few places, has optional trailing commas. That is, if your last item also has a trailing comma, that is okay. To put this into SQL notation: SELECT col1, col2, col3, FROM Table Now the columns were on separate lines, it is easy to comment/uncomment, or copy/paste columns around. just write every column with a comma at the end. But not in SQL -- just in various places in Java code. But I wish that were in SQL. In Java enums are the first that immediately comes to mind. Every item can have a trailing comma. After the final item (and its optional comma) use a semicolon to begin class level declarations for the enum (if any) such as a custom constructor. In Java, another example is array initializers: int[] values = { 1, 2, 3, 4, 5, }; If those initializer items were on separate lines, it is easy to comment/remove/interchange rows because they ALL have a comma.