0

Can scala.xml (XML literals in particular) or scala-compiler be used in Scala.js projects?

This seems like a very basic question, however I did not find this documented anywhere, esp. not in Semantics of Scala.js, where lack of support for scala-reflection is discussed.

2 Answers 2

1

scala.compiler (or, to be precise, scala.tools.nsc) is definitely not supported. An easy way to figure that out is that trying out the following libraryDependencies would fail to resolve:

"org.scala-lang" %%% "scala-compiler" % scalaVersion.value

because there is no Scala.js artifact published for scala-compiler.jar.

Edit: scala-xml has been available for Scala.js since version 1.1.0, as you can see here.

So, it is "documented" in the sense that artifacts are published or not for these libraries with Scala.js.

Usually, libraries who do provide support for Scala.js advertise it on their README. If they do not, the ultimate source of truth is whether artifacts are published or not.

Sign up to request clarification or add additional context in comments.

Comments

1

I believe the answer is "no" for both of these. (sjrd will correct me if I'm wrong.) Basically, any library that is JVM dependent doesn't work on Scala.js.

1 Comment

I suppose so - but is this documented somewhere, or just understood to be obvious? Compared to other libraries, those are often considered more or less a part of the language, same as scala.reflection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.