多包定义 [英] Multiple packages definition
问题描述
While browsing the source code of the Scala API, I met this package definition in scala/tags/R_2_8_0_final/src/library/scala/util/parsing/combinator/syntactical/StdTokenParsers.scala:
package scala.util.parsing
package combinator
package syntactical
那是什么意思?该课程将以多个软件包提供吗?
What does that mean? That the class will be available in more than one package?
推荐答案
这基本上与
package scala.util.parsing.combinator.syntactical
import scala.util.parsing._
import scala.util.parsing.combinator._
...
因此,通过以您编写的方式堆叠"软件包,您可以在范围内获得超级软件包.另请参见这些答案.
So by "stacking" the packages the way you wrote you can get super-packages in scope. See also these answers.
[更新] 这是Martin Odersky撰写的有关该主题的新文章: http://www.artima.com/scalazine/articles/chained_package_clauses_in_scala.html
[Update] Here is a new article written by Martin Odersky about this topic: http://www.artima.com/scalazine/articles/chained_package_clauses_in_scala.html
这篇关于多包定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!