On the virtues of the trailing comma (devblogs.microsoft.com)
from canpolat@programming.dev to programming@programming.dev on 11 Feb 2024 19:09
https://programming.dev/post/9867598

#programming

threaded - newest

xmunk@sh.itjust.works on 11 Feb 2024 21:32 next collapse

SQL needs more trailing commas so fucking badly.

Isoprenoid@programming.dev on 11 Feb 2024 21:49 next collapse

TLDR:

Trailing commas for lists allows easier:

  • merging of code
  • rearranging of items in the list.
lolcatnip@reddthat.com on 11 Feb 2024 22:44 collapse

Commas aren’t the only thing that need similar treatment. For example, Typescript allows a leading | for union types, and for union types split across multiple lines, the result is so much easier to format compared to the equivalent code in, say, Haskell.