From: "marcoroth (Marco Roth) via ruby-core" Date: 2025-06-03T19:23:11+00:00 Subject: [ruby-core:122401] [Ruby Feature#20405] Inline comments Issue #20405 has been updated by marcoroth (Marco Roth). I've been thinking about inline comments since the idea was brought up at RubyKaigi 2025. I agree they���d be a valuable addition to the language, but none of the proposed syntaxes have quite resonated with me. The one that feels most Ruby-like to me is this: ```ruby p #(This is a comment #(and nested one)) :| # => :| ``` or matching the whitespace in the other examples: ```ruby p #( This is a comment #( and nested one ) ) :| # => :| ``` It preserves the look and feel of Ruby���s existing syntax, supports nesting in a visually intuitive way, and I especially like how the closing parenthesis marks the end of the comment. The only downside I see is the similarity to string interpolation (`"#{...}"`), which might be a source of confusion. Curious to hear what others think. ---------------------------------------- Feature #20405: Inline comments https://bugs.ruby-lang.org/issues/20405#change-113574 * Author: nobu (Nobuyoshi Nakada) * Status: Open ---------------------------------------- I propose a new inline comment syntax. ```ruby p (| This is a comment (| and nested one |) /:|) (:|) #=> :| ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/