dub
dub copied to clipboard
Changing the format of `settings.json`
I believe settings.json was a great addition to dub, something I've personally been wanting for a while. Allowing users to e.g. choose their default compiler without having to compile dub itself.
I'd like to extend it, for example by giving it the ability to use a specific Copyright / authors string by default, and by providing a default value for --cache. There are also a few bugs that need fixing (#1472 is trivial, for example).
However, currently, it suffers from one great downside which should make anyone wary of extending it: it is written in JSON.
JSON has proven to be a bad format for human-written configuration. Be it the lack of comments, noisy syntax, lack of typing... So much that a push was done to move to SDLang a few years ago. However JSON enjoys wide support among editors and tools, and is still familiar to people than SDLang, the later being yet another skill a newcomer to D has to pick up.
Hence, I would like to bring forth the idea of changing settings.json to use a different format.
Out of all the markup languages out there, I my vote would go to YAML:
- Almost as widely supported as JSON;
- Easy enough to read;
- We have a great library to read/write it already.
I think the comparison is fairly simple.
Would love some opinion from DUB / settings.json users.
I would like to add. That most importantly, YAML is a superset of JSON. All existing JSON files would still be readable by Dub if the format is changed to YAML. No need for multiple parser inside Dub. Perhaps only the file extension (.json) need to be deprecated.
My vote goes for YAML as well :+1:
Also my vote goes for YAML. It is well known in the industry. Although there should be no need to edit the settings file manually but dub should be capable to set the settings file values by a dedicated command.
I agree with @Geod24 high-level goals of extending setting.json's uses. I'm ok with using YAML (in addition to SDLang) as it's also growing in popularity among various other projects.
However, unless we target this feature for 2.0, we need to keep backwards compatibility and continue supporting the current format of settings.json.
After https://github.com/dlang/dub/pull/2310 we'll be able to do this fairly easily and in a backward-compatible manner.