4 ms·
I also do not agree with that. This is bad for so many reasons. First, to the compiler code, comments should be discarded as soon as possible (often in the lexe
by lohengramm 11y ago
I also do not agree with that. This is bad for so many reasons. First, to the compiler code, comments should be discarded as soon as possible (often in the lexer). To the programmers, comments should never execute anything (this is just intuitively expected). To any go source code reader (human or machine), comments are supposed to contain only human readable text, probably a context sensitive explanation of that particular section of code. To the separation of concerns, comments are comments and compiler directives are compiler directives. To each his own.
This is probably the only decision I disagree with the Go team to date.
- xyproto 11y agoFully agree. I love Go and use it for anything related to servers or the web, but doing anything with comments besides just letting them be comments, is just braindead.
- andrewchambers 11y agoThey aren't used by the compiler at all.
- ominous_prime 11y ago//#cgo //go:nosplit //go:noescpae are all used by the compiler in one way or another
- andrewchambers 11y agonosplit and noescape are internal details which are implementation specific.
- ominous_prime 11y agoAll of these are implementation specific. That's one reason they're in comments, and not listed in the language spec.
- jackielii 11y agothe comment is not executed by the compiler, it's executed by the go tool
- lohengramm 11y agoThanks for the reply. I suppose this changes things regarding the compiler code, but it is still an external tool parsing and executing comments. There should be a better way of doing this.