Hash style comments

Trans transfire at gmail.com
Wed Aug 8 08:58:30 PDT 2012


Hi. First time posting to the list, so please forgive if I am not
following proper approach.

I'd like to make one proposal for future of EMCAScript. I would like
to see support for `#` comment notation.

The reasons for this are more interesting than one might think.

First, of course, is the simple fact that `#` is a very common
notation among programming languages. It is used by Shell scripts,
Ruby, Python, even Coffeescript, and many others.

Secondly, `#` is preferable to `//` in that it is only one character
instead of two, and albeit subjective (IMHO) it just seems a little
bit more aesthetic.

But another reason, that few will at first consider, is the
relationship between JSON and YAML. Their respective development teams
made an effort to ensure JSON was a perfect subset of YAML. Now there
is consideration of JSON5 (https://github.com/aseemk/json5). JSON5
adds support for comments, however it is Javascript style comments,
where as YAML supports `#` style comments. This causes the
superset-subset relationship to break. To help remedy this going
forward, it would be very helpful if EMCAScript also supported `#`
comments. The YAML spec could in turn add support for `//` style
comments.

To be clear, I am not suggesting that `//` be deprecated. That would
simply break far too much old code for no good reason! I am just
seeking for `#` to be supported too.

Thanks for consideration,
trans


More information about the es-discuss mailing list