rascal
rascal copied to clipboard
TODO: use Java 9 modules and layers to separate run-time of bootstrapped Rascal features from User space
- currently the rascal-maven-plugin runs the tutor, the compiler or the console and uses classes from rascal.jar to do so, also .tpl files from rascal.jar which are specific for the correct execution of the implementation of Rascal
- users also depend on rascal projects, like rascal itself or typepal or rascal-core or salix, but possibly different versions than are being used to execute this code of the user.
- in a bootstrapping scenario, the interpreter or compiler itself may depend on a newer version of themselves to be able to run correctly.
- it is not possible in classic Java (without modules and layers) and without OSGI to let two versions of the same jar (rascal-x and rascal-y) co-exist. Only the class which is loaded from the first jar in the path is loaded. If the class is not present in the first, it will go to the second.
So this is a big issue in the use of Rascal between different versions of Rascal for users, and it practically makes it impossible to make significant changes during a bootstrap.
The solution might be to add a "module layer" around loading the current run-time of Rascal, and a second around the user code:
- this would separate platform code from user code and allow them to load the same library but with different versions
- it solves both the bootstrapping and the upgrading issues.
See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ModuleLayer.html
Typically, the example there shows how an application server would isolate their classes from the libraries loaded by specific applications. That sounds a lot like our scenario where the rascal interpreter or compiler is the "application server" and the client code being executed is the "application", imho.
Challenges identified:
- intern'd stuff like schemes of source locations and the respective implementations of
equalswould be broken for values that travel between layers. - we don't know which values would travel between these layers.