title: Commenting out portions of code in Scala
body: <p>I am looking for a C(++) <code>#if 0</code> -like way of being able to comment out whole pieces of Scala source code, for keeping around experimental or expired code for a while.</p>
  
  <p>I tried out a couple of alternatives and would like to hear what you use, and if you have come up with something better?</p>
  
  <pre><code>// Simply block-marking N lines by '//' is one way... 
  //  &lt;tags&gt; """ anything
  </code></pre>
  
  <p>My editor makes this easy, but it's not really The Thing. It gets easily mixed with actual one-line comments.</p>
  
  <p>Then I figured there's native XML support, so:</p>
  
  <pre><code>&lt;!-- 
    ... did not work
  --&gt;
  </code></pre>
  
  <p>Wrapping in XML works, unless you have <code>&lt;tags&gt;</code> within the block:</p>
  
  <pre><code>class none { val a= &lt;ignore&gt;
    ...
    cannot have //&lt;tags&gt; &lt;here&gt; (not even in end-of-line comments!)
  &lt;/ignore&gt; }
  </code></pre>
  
  <p>The same for multi-line strings seems kind of best, but there's an awful lot of boilerplate (not fashionable in Scala) to please the compiler (less if you're doing this within a class or an object):</p>
  
  <pre><code>object none { val ignore= """ This seems like
    ...
    &lt;truly&gt; &lt;anything goes&gt; but three "'s of course
  """ }
  </code></pre>
  
  <p>The 'right' way to do this might be:</p>
  
  <pre><code>/***
    /*
    ... works but not properly syntax highlighed in SubEthaEdit (or StackOverflow)
    */
  ***/
  </code></pre>
  
  <p>..but that matches the <code>/*</code> and <code>*/</code> only, not i.e. <code>/***</code> to <code>***/</code>. This means the comments within the block need to be balanced. And - the current Scala syntax highlighting mode for SubEthaEdit fails miserably on this.</p>
  
  <p>As a comparison, <a href="http://www.lua.org/manual/5.2/manual.html#3.1">Lua</a> has <code>--[==[</code> matching <code>]==]</code> and so forth. I think I'm spoilt?</p>
  
  <p>So - is there some useful trick I'm overseeing?</p>