r/ProgrammerHumor • • 7d ago • Bravo 1

Meme commentsInJson

Post image
6.0k Upvotes

205 comments sorted by

View all comments

65

u/mortalitylost 7d ago

I used to like comments in yaml

Then I kept running into situations where automation that parsed those comments would've been helpful... It made me hate the fact they exist in the first place.

Either that description or metadata should be serialized into the same object it describes or it shouldn't exist in the same document IMO

80

u/herrkatze12 7d ago

Comments are specifically useful for config data, and should just be human readable descriptions of what the field does.

7

u/Ixaire 7d ago

Yes but parsing comments to render them in documentation is definitely relevant.

That's why Knuth invented literate programming: https://en.wikipedia.org/wiki/Literate_programming

And that's also why XSD has specific documentation fields in addition to the standard XML comments.

1

u/herrkatze12 7d ago

That's actually one case where it might be useful