Feature #17640
closedallow // for comments
Description
- ruby uses '#' for comments (from the sh heritage)
- js and css use '//' for comments (from the C++ heritage)
I'd like to discuss,
to allow '//' in ruby code for comments
Motivation:
- writing comments is good
- it's cumbersome to adapt the comments to the language currrently active
Impact:
Please check:
- '//' is not a token in ruby?
- there is no way to make a legal expression involving '//'?
- oops ... the empty regexp literal is //
This is where the things get complicated
in terms of full backwards compatibility.
But I think that can be done.
'//i' is a legal expression,
while '// i' never was?
Anyways, I just want to put this on for a first discussion.
Updated by shan (Shannon Skipper) over 3 years ago
Like you mention, //
is a Regexp literal, so it seems to me this would be a nonstarter since it'd break a ton of code. How would the parser know whether it's meant to be a Regexp or comment?
I've not found #
cumbersome at all. It even saves typing a character! /s
Updated by matz (Yukihiro Matsumoto) over 3 years ago
- Status changed from Open to Rejected
Yes, it's an empty regular expression. I don't think it's worth breaking many existing codes.
Actually, I once thought of an idea to use //
as an operator and gave the idea up.
Matz.