Supporting yet another syntax element isn't that easy: there are plenty of tools which should be able to handle yet additional comment style. Actually, I wouldn't be surprised to see that most tokenizers/parsers simply ignore newlines, probably replacing them by ;
.
If it would be essential to the language, i.e. make developers' lives much easier, this could be done. For instance, not having any sort of comments in CSS would suck, and it would be worth the effort to add specific syntax elements which delimit comments. //
-style comments on the other hand?... I don't see the point. See, /* Hello, World! */
: a one-line comment.
Actually, you probably expect //
-style comments because you are used to them in C++ or similar languages. However, CSS doesn't inherit from C++, so expecting similar syntax features is rather strange.
Similarly, a Python programmer would claim that CSS should also have #
-style comments; so now, do we need to support both styles? Then a guy from Haskell world would ask to include --
and {- -}
as well, and you'll ask yourself why don't you recognize CSS code any longer.
The tiny benefit of //
is that you don't have to type three more characters at the end of your single-line comment (actually, if we start counting characters, CSS should use Python-style comments). However, if you use a decent text editor, you comment/uncomment text simply by pressing a shortcut anyway.
They [...] seem particularly useful for a language like CSS where each rule is on it's own line.
As I explained, they are only slightly useful, for a small subset of programmers, using a small subset of text editors. As for your remark about the each rule on its own line (I disagree with your remark, by the way), this made me think about another point: how the comments are actually used.
Here's the usage of CSS comments I can think of:
- As a file header (copyright info, vanity stuff, etc.)
- As a delimiter of a group of styles.
- As an explanation of a hack.
- As a detail about a particular style or property.
In the first three cases, you'll use multiline-style comments anyway. This is obvious for the file header and the explanation of a hack (most hacks require at least a sentence and a hyperlink to StackOverflow or a blog article); as for the delimiters:
/**
* Footer and sitemap styles.
*/
C-style comment is much more visible than:
// Footer and sitemap styles.
buried in text.