On the beauty of the trailing comma
and why it should be a default for JSON and why everyone should use tab
First, let's be honest, it will be a half-troll/half-serious post.
Not too long ago, I had to manually edit a JSON file (don't ask why 🫢). And like always, it took me 15 minutes to understand why things didn't work. And like always, it was because I put a comma at the end of a list… It's 2025 ! I know about JSON5, but how it's not a default for every JSON parser ? It's crazy. Right ?
This led to me thinking of the magnificent advantages trailing commas have. How cute 😸 and dependable these ,
were. And how I loved them so much 💖.
In the not less beautiful language that is the noble PHP, I can put these cuties after the last element of any list, of course ðŸ¤, but also after the last argument in a function call, and even after the last argument in a function definition ! The mighty PHP even allows them in use
list !
Now the long awaited ode to trailing commas
I love how fast I can add an element in a long list, thanks to you ! I love how easy it is to read a commit diff, thanks to you ! I love how beautiful are my calls over 72 characters wide, now divided in several pretty lines ! How could I ever stop dreaming of you when writing JSON ? The JSON5 standard should definitely always be turned on You're the sunshine in my life, the standard of standards, the truth that everyone should listen to ! And I know you love me too !
And thanks to all the other serious language that that allows this gem to express itself every day !
That's all, folks 🫡 !
And one day I'll really post a thesis about how tab indent should be the only accepted truth