On Sat, Nov 9, 2013 at 4:18 PM, sikachu (Prem Sichanugrist) <s / sikac.hu>
wrote:

I've been using here document (heredoc) for a while, and I've found out
> that it's very annoying that the content is always treated as flushed lef=
t.

 This has actually bugged me for a very long time. Other languages have
triple-quoted strings where the indent of the opening triple-quote is taken
into account, and automatically stripped from the resulting text. In Ruby
if I don=92t want leading spaces I have to break the visual flow of my
indentation (or resort to something like #strip_heredoc).

I don=92t agree with changing the existing heredocs to have new semantics.
But I could see adding e.g. a "squiggly-heredoc":

class Foo
  BAR =3D <<~EOF
  This line is
  cleanly indented
  EOFend
Foo::BAR # =3D> "This line is\ncleanly indented"

Note that the way I imagine it, this would work a little different than
triple-quoted strings in other languages, since the indentation wouldn=92t =
be
determined by the location of the opening signifier. Instead, it would be
determined by indentation of the first non-whitespace character inside the
heredoc.
--=20
Avdi Grimm
http://avdi.org

I only check email twice a day. to reach me sooner, go to
http://awayfind.com/avdi