Hacker News new | ask | show | jobs
by masklinn 1137 days ago
> as I’m concerned means they’re not comments at all

Smuggling pragmas in comment has a long and rich history. It’s literally the reason why json does not support comments.

> Reading about JSDoc gives me the same uneasy feeling, even if it’s not quite the same thing.

It’s not just “not quite the same thing”, it’s entirely unrelated in every way and shape. JSDoc does not affect the runtime behaviour of its code, or how that code interacts with other systems.

1 comments

> JSDoc does not affect the runtime behaviour of its code, or how that code interacts with other systems.

At the moment. You’ve literally just said yourself that there is a long history of smuggling code into comments. A few years down the line I don’t want to suddenly have the feature added and then have to be on the look out when I’m debugging a codebase for secret code in comments.

There’s also a long history of smuggling code into JS comments (JSX pragmas, pure), and seemingly noop directives (“use strict”). They’re all hacky but there’s a very strong resistance in the community to mixing intent with JSDoc (good luck signaling anything to TS or eslint in a JSDoc block!). I think it’s safe to write this possibility off as “probably not inevitable”.