多包定义 [英] Multiple packages definition

查看:70
本文介绍了多包定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在浏览Scala API的源代码时,我在

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_pa​​ckage_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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆