-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
It would be a game-changer if the compiler could be executed on more platforms:
- In the browser on the client side (not requiring central servers)
- NodeJS
- Natively
This would open up for many more use cases, for instance better web-based development environments.
-
One example use-case is using Scala for programming by kids in school who often only have a locked down machine with browser only; relying on fast and reliable enough network and sponsored server infrastructure such as Scastie or KojoJS is not always feasible (e.g. someone needs to sponsor the compute + certificates etc and there can be server congestion if many students compiles simultaneously, and some schools requires https-servers etc).
-
Another use case might be execution of the compiler on bare metal when the JVM is not available; @WojciechMazur @ekrich is this use case relevant to the Scala Native community?
-
This would also open up for a NodeJS-only server execution without the dependency on sbt and JVM etc.
If I understand input from @sjrd, there are some obstacles that need workarounds:
- The compiler relies on the actual file system
- Support for macros use JVM class loading of class files
- The ScalaJS backen produces classfiles that are used downstream by other tools such as zinc to support incremental compilation.
Achieving the goal of plug-able execution platforms would perhaps not necessarily mean a fork of the compiler if the actual execution platform could be abstracted over as a context? Perhaps the things that are specific to the JVM step-by-step can be moved to a CompilerExecutionContext and the mechanics that are very platform-specific then be implemented in different given contexts? This could be an interesting, incremental modularization of the code base, perhaps with other benefits as well...
This issue is based on previous discussions here with @julienrf and @sjrd :
https://teachers.scala-lang.org/t/web-based-development-environments/18/4