Hacker News new | ask | show | jobs
by yokohummer7 3079 days ago
I hated the idea of using comments as directives when Go 1.4 introduced //go:generate. But, holy, they were there from the beginning?

They bring back my painful memories of the old days when I had to use conditional comments to support IE6...

4 comments

Comments are also interpreted by go build, to choose which files to build on each platform. Memories of IE6 are painful because of the deviation from the standard, but with Go you don’t have that problem.
Every higher level language has directives nowadays, and those almost every time encoded in comments.

Honestly, between documentation, compiler pragmas, linter directives, packaging and linking instructions, and etc, we are getting into a point where languages will need to specify something like "comments starting with this string must be ignored".

> and those almost every time encoded in comments

which lanugages do that?

Possibly off topic, but Verilog has something similar. //read_comments_as_hdl_on is a thing and it makes it a pain.
IE's conditional comments were actually a pretty elegant solution given that you had to be compatible with every other HTML parser out there. The painful memories that I recall are about IE 6/7 itself, not about conditional comments.