Project

General

Profile

Actions

Feature #7639

closed

More freedom for location of comments

Added by sawa (Tsuyoshi Sawada) almost 12 years ago. Updated about 5 years ago.

Status:
Closed
Target version:
[ruby-dev:46822]

Description

When we chain methods with the period at the end of each line, we can put comments in between the lines:

[1, 2, 3].
# First, we do blah blah
method1.
# Second, we do blah blah
method2.
=begin
  Third, the following line
  does this
  and that ...
=end
method3

but when we have the period at the beginning of the line, putting comments in similar positions returns an error:

[1, 2, 3]
# First, we do blah blah
.method1
# Second, we do blah blah
.method2
=begin
  Third, the following line
  does this
  and that ...
=end
.method3

# => Error

It is confusing that putting comments between lines in a method chain is sometimes allowed and sometimes not. I think it would be convenient if comments are allowed in these positions even when the following line starts with a period, and I request this as a feature. Currently, it returns an error, which means that, if such syntax were allowed, there would be no conflict with the existing syntax.

Furthermore, putting the period at the beginning of a line is suited for method chains because the period will visually work as bullets, and it makes more sense to have comments right before those lines.


Related issues 2 (1 open1 closed)

Related to Ruby master - Feature #14463: Allow comments to precede dots in member expressionsOpenActions
Has duplicate Ruby master - Feature #11678: ability to comment out methods in a multi-line method chain without needing a new line escapeClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0