2

在Scala in Action一书中说,在 Scala REPL中使用:import命令我们将看到:

scala> :imports 
    1) import java.lang._       (153 types, 158 terms)
    2) import scala._           (798 types, 806 terms)
    3) import scala.Predef._    (16 types, 167 terms, 96 are implicit)

并且根据这本书,上面的那些包都是自动导入的。但在我的 REPL (Scala 2.10.2) 中它只返回一行:

scala> :imports
     1) import scala.Predef._   (162 terms, 78 are implicit)

有什么不对?

4

1 回答 1

3

“Scala in Action”是为 2.9 编写的:

:~$ scala
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_25).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :imports
 1) import java.lang._             (193 types, 199 terms)
 2) import scala._                 (798 types, 804 terms)
 3) import scala.Predef._          (16 types, 167 terms, 96 are implicit)
于 2013-09-26T07:18:04.757 回答