开发者

What's the purpose of $scope in scala.Predef?

开发者 https://www.devze.com 2023-03-31 02:53 出处:网络
scala.Predef contains the following code: // Apparently needed for the xml library val $sco开发者_运维百科pe = scala.xml.TopScope

scala.Predef contains the following code:

// Apparently needed for the xml library
val $sco开发者_运维百科pe = scala.xml.TopScope

Did someone figure out why it is necessary, considering that it creates dependencies to packages which could have been easily split out of the standard library?


Take a look at src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala, and the result of parsing an XML literal.

scala -Xprint:parser -e '<node/>'

new _root_.scala.xml.Elem(null, "node", _root_.scala.xml.Null, $scope)

Ideally this would be moved somewhere under scala.xml; try it and see what breaks.

0

精彩评论

暂无评论...
验证码 换一张
取 消