On 10/22/07, <b class="gmail_sendername">Neil Mitchell</b> &lt;<a href="mailto:ndmitchell@gmail.com">ndmitchell@gmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If this now reports no errors, who wants to guess which come up as<br>escape codes, and which don&#39;t. The way other languages like C# have<br>dealt with this is by introducing a new type of quoted string:<br><br>@&quot;:\/&quot;
</blockquote><div><br>The C# implementation is really annoying, because quotes appear in
strings so often. Whenever I wanted to use that facility its because I have some inline XML, and I have to double up all the quotes after pasting it in.<br><br>I like the idea of &#39;heredocs&#39; from Ruby, PHP and
others. Using Ruby, I can specify a string fairly easily:<br>
<br>
&nbsp; puts &lt;&lt;-EOS<br>
This is a long string<br>
that will print as formatted,<br>
&nbsp; including spaces, &quot;quotes&quot; and<br>
newlines.<br>
EOS<br>
<br>Note that quotes and such don&#39;t need to be escaped. What&#39;s really sweet is Ruby treats that as a string in-place, so if puts took more arguments they just come after the heredoc:<br>
<br>
&nbsp;puts &lt;&lt;-EOS, &quot;foo&quot;, true, 1<br>
My string which<br>
doesn&#39;t interfere with the arguments above<br>
EOS<br>
<br>
Of course, because strings are just another object in Ruby, you can call methods on the string constructed:<br>
<br>
&nbsp; puts &lt;&lt;-EOS.length<br>
This will print<br>
the length of the<br>
string.<br>
EOS<br>&nbsp;
<br>My two cents - I haven&#39;t found another language that handles heredocs as nicely as Ruby does.<br><br>Justin<br></div></div>