Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><em>EDIT: after reading your question again, I have to admit, that I didn't really answer it ;). But maybe it still helps.</em></p> <p>I know of two limitations of interpreter (or REPL), when it comes to loading scala files (in order to interactively test them).</p> <ul> <li>You can't load scala files with package definitions in them. REPL complains and does not load all class is the scala file to be loaded. It read that it has to do with the fact that files that are loaded into the REPL are treated as an object . . . which of course can't have any package definitions in them.</li> <li>REPL is strange (or a little bit unpredictable) when there are class files of loaded scala files on the classpath. Check out <a href="https://stackoverflow.com/questions/3617351/weird-type-mismatch-in-scala">this question by myself</a> and especially my 2 last comments to the second answer.</li> </ul> <p>Furthermore there is a problem with circular dependencies, that I don't know a workaround for: Suppose there is a Class <code>A</code> that uses Class <code>B</code> which again needs <code>A</code> to do it's job. Of course you can't define <code>A</code> since there is no definition of <code>B</code> and vice versa. Providing a dummy for one of those doesn't work either:</p> <pre><code>scala&gt; class A { | def alterString(s:String) = s | def printStuff(s:String) = println(alterString(s)) | } defined class A scala&gt; class B { | val prefix = "this is a test: " | def doJob() = new A() printStuff "1 2 3" | } defined class B scala&gt; class A { | def alterString(s:String) = new B().prefix + s | def printStuff(s:String) = println(alterString(s)) | } defined class A scala&gt; new B().doJob() 1 2 3 scala&gt; </code></pre> <p>Although I already provided a newer definition of <code>A</code>, class <code>B</code> still used the one that was present when I defined it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload