ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "sawa (Tsuyoshi Sawada)" <sawadatsuyoshi@gmail•com>
To: ruby-dev@ruby-lang.org (ruby developers list)
Subject: [ruby-dev:46914] [ruby-trunk - Feature #7639] More freedom for location of comments
Date: Sun, 3 Feb 2013 22:33:47 +0900	[thread overview]
Message-ID: <redmine.journal-35807.20130203223347@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-7639.20121231022931@ruby-lang.org


Issue #7639 has been updated by sawa (Tsuyoshi Sawada).


Indeed, method chains do seem to continue beyond empty lines. The following two work:

[1, 2, 3].

map{|x| x * 2}

[1, 2, 3].
#
map{|x| x * 2}

But the following does not, (which I claim is strange, given that the above two work):

[1, 2, 3]
#
.map{|x| x * 2}

----------------------------------------
Feature #7639: More freedom for location of comments
https://bugs.ruby-lang.org/issues/7639#change-35807

Author: sawa (Tsuyoshi Sawada)
Status: Feedback
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: Next Major


=begin
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.
=end



-- 
http://bugs.ruby-lang.org/

  parent reply	other threads:[~2013-02-03 13:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-30 17:29 [ruby-dev:46822] [ruby-trunk - Feature #7639][Open] More freedom for location of comments sawa (Tsuyoshi Sawada)
2012-12-31  7:07 ` [ruby-dev:46825] [ruby-trunk - Feature #7639] " nobu (Nobuyoshi Nakada)
2013-01-03  9:35 ` [ruby-dev:46830] " duerst (Martin Dürst)
2013-01-24  8:51 ` [ruby-dev:46886] " sawa (Tsuyoshi Sawada)
2013-01-25  8:35 ` [ruby-dev:46892] " knu (Akinori MUSHA)
2013-01-25  9:20 ` [ruby-dev:46893] " duerst (Martin Dürst)
2013-02-03  5:29 ` [ruby-dev:46907] " sawa (Tsuyoshi Sawada)
2013-02-03 13:10 ` [ruby-dev:46912] [ruby-trunk - Feature #7639][Feedback] " nobu (Nobuyoshi Nakada)
2013-02-03 13:12 ` [ruby-dev:46913] [ruby-trunk - Feature #7639] " nobu (Nobuyoshi Nakada)
2013-02-03 13:33 ` sawa (Tsuyoshi Sawada) [this message]
2013-02-03 18:44 ` [ruby-dev:46915] " alexeymuranov (Alexey Muranov)
2013-02-04  2:24 ` [ruby-dev:46916] " sawa (Tsuyoshi Sawada)
2013-02-04  5:11 ` [ruby-dev:46918] " knu (Akinori MUSHA)
2019-09-16 12:20 ` [ruby-dev:50846] [Ruby master Feature#7639] " sawadatsuyoshi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-35807.20130203223347@ruby-lang.org \
    --to=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).