6

scala.Predef contains the following code:

// Apparently needed for the xml library
val $scope = 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?

soc
  • 27,983
  • 20
  • 111
  • 215

1 Answers1

4

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.

retronym
  • 54,768
  • 12
  • 155
  • 168