Project

General

Profile

Actions

Feature #17640

closed

allow // for comments

Added by foonlyboy (Eike Dierks) about 3 years ago. Updated about 3 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

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.

Actions #1

Updated by shan (Shannon Skipper) about 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

Actions #2

Updated by matz (Yukihiro Matsumoto) about 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0