Closed hendrikvanantwerpen closed 3 years ago
I'll post a link to an NaBL2 PR to show how I use this
Can you post that link?
I think this change makes sense, but I do not agree with adding Stratego primitives for access to the configuration data, because that couples the Stratego code to Spoofax Core, making it hard/impossible to run outside of Spoofax Core. Can't you convert the configuration into a term and send it to the Stratego code?
The change was in an NaBL2 primitive that was also in this repo: https://github.com/metaborg/spoofax/pull/46/files#diff-36c5cc68eb05f6767150900d6720d35a
Currently I have a NaBL2 specific primitive to access that value. A general primitive would be in the same group as the primitives for getting language names, source dirs etc. I think those also don't run outside of Spoofax? Do you expect Stratego code from meta-languages to run outside Spoofax anyway?
Currently those do not run outside of Spoofax Core no, but I would like to prevent adding more stuff that does not run outside of Spoofax Core. Existing code can stay the same for now, but adding those generic primitives opens the door for even more coupling with Spoofax Core.
Closing this, as it never materialized.
This PR implements a generic mechanism for access to language-specific configuration in the project file. It exposes settings for every language below
runtime
. So, an example configuration might be:The idea is that the language can access this information when it is executed, so its behavior can be tweaked per project. I had implemented something specifically for NaBL2. This change makes it possible to keep the Core code independent of the language specific primitives. I'll post a link to an NaBL2 PR to show how I use this.
It does expose an Commons Configuration type in the interface, which is maybe not super elegant. However, I think it is worth that, given that this makes it much easier for languages to allow control over runtime settings such as log levels etc. Maybe it is a good idea to add some generic primitives in
libspoofax
to get these settings directly in Stratego, without having to write a Java primitive or strategy.