I'm having a very strange behaviour from my scala interpreter/compiler.
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
scala> class Foo {
| def bar = {
| println("Foo is bar!")
| }
| }
defined class Foo
scala> var f = Foo()
<console>:7: error: not found: value Foo
var f = Foo()
^
scala>
I also tried putting it in a single file main.scala
class Foo {
def bar = {
println("foo is bar!")
}
}
object Main {
def main(args: Array[String]): Unit = {
println("ciao")
Foo()
}
}
$ scalac main.scala
main.scala:10: error: not found: value Foo
Foo()
^
one error found
Coming from Java/Python, I really don't understand why the simple class Foo is not found, especially in the interpreter. What am I missing?
I'm running Scala 2.10.3 installed via homebrew in Mac Os X 10.9
Thanks a lot
(I'm having, of course, the same problem using SBT)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…