4 ms·
> One thing I personally would change is making a trailing comma in multiline lists obligatory Can I ask you why?
by izietto 8y ago
> One thing I personally would change is making a trailing comma in multiline lists obligatory
Can I ask you why?
- ainar-g 8y agoSure. In Go, this was one of the details that cemented my love for the language. Imagine you have a multiline list, sorted alphabetically. strs = [ "a", "b", "c" ] If you don't have a trailing comma (looking at you, JSON), when you add a new item, you have to make changes on two lines: strs = [ "a", "b", "c", // Change 1. "d" // Change 2. ] On the other hand, when you have obligatory trailing comma on multiline lists, there is only one change: strs = [ "a", "b", "c", // No change, since the comma was already there. "d", // Change 1. ]
- z0mbie42 8y agoVery pragmatic, I love it! I will explore this.