http://qs321.pair.com?node_id=1198902


in reply to Re^2: Freezing a regular expression qr()
in thread Freezing a regular expression qr()

As a nonstandard extension to the JSON syntax that is enabled by the relaxed setting, shell-style comments are allowed.

I don't like that. It feels like an "impedance mismatch". Why on earth would one want to use comment syntax from (unix) shells in something derived from JavaScript? JSON was designed so that you could simply pass it to JavaScript's eval function (yes, that would be insecure, but it is possible). Using shell comments breaks that feature. The most natural comment extension for JSON would be JavaScript comments, i.e. from /* to the next */ and from // to the next end of line.

The //-style comments have the slight disadvantage of giving some whitespace characters (\r and \n) a second meaning, whereas pure JSON treats all whitespace characters outside strings equally and allows to freely replace them with other whitespace characters.

Apart from shell comments, I can only imagine two more mismatching comment variants:

But while surfing, I found an even more mismatching comment syntax at http://www.gavilan.edu/csis/languages/comments.html:

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)