5 ms·
Partially agreed. Directives should be visually distinct from comments and syntax should be formally defined such that compilers, code generators, editors and I
by saintfiends 11y ago
Partially agreed. Directives should be visually distinct from comments and syntax should be formally defined such that compilers, code generators, editors and IDE's can use them consistently.
- NateDad 11y agoThe compiler doesn't need to care about these directives. They don't have anything to do with the compiler. That's half the reason they're in comments. Otherwise you're just adding another kind of comment the compiler has to also ignore. The directives are pretty visually distinct. You could easily configure your editor to highlight them differently if you so chose.
- saintfiends 11y ago1. I don't understand what you mean by "They don't have anything to do with the compiler" https://golang.org/cmd/gc/#hdr-Compiler_Directives https://golang.org/cmd/gc/#hdr-Compiler_Directives 2. I could keep adding syntax support as they come along and handle all the inconsistencies, but that is not a solution. It's a hack.