title: How to write Scala 2.9 code that will allow dropping into an interpreter
body: <p>I am not sure how to write code that will allow dropping into an interpreter into Scala 2.9 code. This question is a follow-up to <a href="https://stackoverflow.com/questions/2160355/drop-into-interpreter-during-arbitrary-scala-code-location">this one</a>, which asked what the Scala equivalent of,</p>
  
  <pre><code>import pdb
  pdb.set_trace()
  </code></pre>
  
  <p>was from Python.  The advice given there was primarily for Scala 2.8, and the related packages no longer exist in their previous form.  Namely,</p>
  
  <ol>
  <li><code>scala.nsc.tools.nsc.Interpreter.{break, breakIf}</code> have been moved to <code>scala.nsc.tools.nsc.interpreter.ILoop.{break, breakIf}</code></li>
  <li><code>DebugParam</code> is now <code>NamedParam</code> in scala.tools.nsc.interpreter</li>
  </ol>
  
  <p>As noted in the original post, the class path of the parent process is not passed to the new interpreter automatically, so a workaround was presented <a href="https://gist.github.com/290632" rel="nofollow noreferrer">here</a>.  Unfortunately, many of the classes/methods invoked there have now changed, and I'm not quite sure how to modify the code the behave as "expected".</p>
  
  <p>Thanks!</p>
  
  <p>EDIT: Here is my test code, which at current compiles and runs, but attempting to execute anything in the debugger results in the application freezing if compiled by <code>scalac</code> and executed by <code>scala</code></p>
  
  <pre><code>import scala.tools.nsc.interpreter.ILoop._
  
  object Main extends App {
  
    case class C(a: Int, b: Double, c: String) {
      def throwAFit(): Unit = {
        println("But I don't wanna!!!")
      }
    }
  
    // main
    override def main(args: Array[String]): Unit = {
  
      val c = C(1, 2.0, "davis")
  
      0.until(10).foreach {
        i =&gt; 
          println("i = " + i)
          breakIf(i == 5)
      }
    }
  }
  </code></pre>
  
  <p>EDIT2:  As my current setup is running through sbt, I have discovered that this topic is covered <a href="https://github.com/harrah/xsbt/wiki/FAQ" rel="nofollow noreferrer">in the FAQ</a> (bottom of the page).  However, I do not understand the explanation given, and any clarification on <code>MyType</code> would be invaluable.</p>
  
  <p>EDIT3: another discussion on the topic without a solution: <a href="http://permalink.gmane.org/gmane.comp.lang.scala.simple-build-tool/1622" rel="nofollow noreferrer">http://permalink.gmane.org/gmane.comp.lang.scala.simple-build-tool/1622</a></p>