3 ms·
It's not about typing; code is never really about keystrokes. It's about easily moving lines around (up/down, copy paste, etc), diff noise (only one line change
by Cthulhu_ 2y ago
It's not about typing; code is never really about keystrokes. It's about easily moving lines around (up/down, copy paste, etc), diff noise (only one line changed instead of two), etc. See also https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Trailing_commas https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...; it's always been allowed in JS, even though if I recall correctly Internet Explorer didn't allow it.
Anyway, SQL is a different beast entirely, this is specifically about hand-written SQL which needs to be optimised for readability and comprehension, both in the query itself and the diffs changing them. Spreading columns and arguments across multiple lines is common if not mandatory for writing maintainable SQL.
- elric 2y ago> It's not about typing > It's about easily moving lines around Those are the same thing, just different keystrokes. > diff noise This is a non-issue, or rather a solved issue. Any half competent diff tool does word diffs instead of just line diffs. Changing the syntax of many (every?) programming language to promote "better diffs" seems over the top. And what's the result? "a,b" -> "a,b,c" vs "a,b," -> "a,b,c," both have equally "noisy" diffs. > Spreading columns and arguments across multiple lines is common if not mandatory for writing maintainable SQL. I agree. But I disagree that a trailing comma makes it more readable or maintainable in any way. I can't look at a trailing comma without wondering what's missing.