Unexpected multi-line comment parsing feature with Go 1.8.3
When a string in a multi-line comment contains a */, it is interpreted as the comment end marker.
/* var s = "abc */ def" */
The compiler reports an error. Using back ticks yields the same result.
This feature was a problem when trying to comment out regex expressions. They frequently contain */.
There is no such problem with the // comment. See http://ift.tt/2tnTqWZ
var s = "abc // def"
This compiles without error. This is the behavior I would expect.
I don't see a use case for a multi-line comment ending in the middle of a string. These comments are usually used at instruction boundary.
What is your opinion about it ?
Submitted July 15, 2017 at 12:22AM by chmikes
via reddit http://ift.tt/2tRaSq2