3 ms·
> The reason it feels like a kludge is that "comments" are normally understood to be non-impactful. Is a source transformation that removes all comments valid?
by joshuamorton 7mo ago
> The reason it feels like a kludge is that "comments" are normally understood to be non-impactful. Is a source transformation that removes all comments valid? If comments have no impact per the spec, yes. But that's not the case here.
This is not inlining in the compiler. It's a directive to a source transformation (refactoring) tool. So yes, this has no impact on the code. It will do things if you run `go fix` on your codebase, otherwise it won't.
- dwattttt 7mo agoAnd yet it still breaks "comments aren't semantic". That transformation I described is still invalid.
- pastel8739 7mo agoI don’t understand why that wouldn’t be valid. As far as I understand if you compile code with these go:fix comments, they will be ignored. But if instead of compiling the code you run ‘go fix’, the source code will be modified to inline the function call. Only after the source code has been modified in this way would compiling reflect the inlining. Do you have a different understanding?
- dwattttt 7mo agoI mean that directives other than inlining impact correctness. If you have a source file that only builds for one OS, stripping the build tag will break your build.