3 ms·
> That structure can be parsed and used for documents, editor hints, diagrams, and even type check validations. > Instead of having to traverse the entire call
by allendoerfer 4y ago
> That structure can be parsed and used for documents, editor hints, diagrams, and even type check validations.
> Instead of having to traverse the entire callgraph of a function to have an idea of what guarantees it provides, you simply read the documentation tag.
> This is O(1) instead of O(V+E) where V are the functions and E are how you call them.
Unless of course it is wrong, because it is just a convention for a comment and not actually an enforced type.
- 29athrowaway 4y agoThe right direction is: more explicit information, more commitment on a stable contract with explicit guarantees, maximize machine readability. The wrong direction is: less information, no stable contracts, forcing people to guess, complete chaos and anarchy, make up your own format with your own tags that nobody supports.
- allendoerfer 4y agoWe are on the same page, which is why I would advise to use TypeScript instead of JSDoc.
- 29athrowaway 4y agoWhen you can use it, you should. My comparison was between: - JavaScript with no documentation tags - JavaScript with non-machine readable documentation - JavaScript with documentation tags