The current XML dependencies include:
- The scalac parser has to invoke a specific XML parser to parse an XML literal. That’s a fixed dependency. If you want to have a different parser you have to hack the compiler.
- Predef contains a special $scope entry for namespace management, that the compiler knows about.
- The parser generates XML trees invoking specific methods from
There might be other dependencies as well. Could this be factored out in a general XML implementation API, to be provided by general XML libraries? Maybe, but I believe it would be quite messy. But that’s not all. Scala is a language, not a compiler. So if we want to open up XML to alternative implementations we have to put the internal compiler XML API in the language spec. This, to me, is intolerably ugly.
Compare how simple it is to treat XML as interpolated strings. You get the
xml interpolator from some library and that’s it! Nothing to burden the language with.