From: alexey.muranov@... Date: 2014-03-27T13:36:43+00:00 Subject: [ruby-core:61716] [CommonRuby - Feature #9678] New heredoc syntax Issue #9678 has been updated by Alexey Muranov. I try to summarize again, hopefully better, and with a bit different syntax. ### Example class C def f(x) print < 1. Some text > without any intepolation (#{ x }) or escape sequences (\n) > Message2: >> 2. Some text\ >> with interpolation (#{ x }) and escape sequences.\n Message3: >> 3. Some mixed text: \ > #{ x } is replaced with >> #{ x } end end C.new.f(42) should print 1. Some text without any intepolation (#{ x }) or escape sequences (\n) 2. Some text with interpolation (42) and escape sequences. 3. Some mixed text: #{ x } is replaced with 42 ### Explanation In each line preceeded with single `>`, the leading `>` and one space are removed, and the rest is interpreted as a single-quoted string: > is the same as ' ' In each line preceeded with `>>`, the leading `>>` and one space are removed, and the rest is interpreted as a double-quoted string: >> is the same as " " Then lines are concatenated. I hope my proposal is more clear now. ---------------------------------------- Feature #9678: New heredoc syntax https://bugs.ruby-lang.org/issues/9678#change-45959 * Author: Alexey Muranov * Status: Feedback * Priority: Normal * Assignee: * Category: * Target version: ---------------------------------------- For whatever it is worth, i've just had this idea of a new heredoc syntax for some programming language: class C def f(x) print >>Message1 + >>Message2 Message1: > Literal text > ------------ > Here text. > Message2: >> Text with interpolation and escapes >> ----------------------------------- >> Here text with interpolation: #{ x }. >> end end -- https://bugs.ruby-lang.org/