2013-09-26 141 views
2

它在書中斯卡拉說,在行動,使用:斯卡拉REPL內進口命令,我們將看到::斯卡拉REPL裏面輸入命令

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) 

有什麼問題嗎?

+0

其中斯卡拉的版本在書中用的? – 4lex1v

+0

AlexIv:這是2.10.0 – Pauli

回答

3

「斯卡拉在行動」是爲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) 
+0

謝謝alatar。但在電子書中,它是2.10.0。作者:「我正在運行Scala版本2.10.0,並且所有代碼示例都適用於此版本及更高版本。」 – Pauli

+0

@Pauli我認爲這個答案是正確的,因爲在編寫頁面上它寫的是該書更新爲2.10,但起初它是寫在2.9以下。 repl列表沒有更新爲2.10。因爲這個輸出真的只有2.9 – 4lex1v

+0

oic,謝謝Alexlv – Pauli