簡體   English   中英

Scala REPL中的:import命令

[英]:import command inside Scala REPL

在《 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)

有什么不對?

“ 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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM