dub: JSON, SDL, YAML, TOML, what color should we paint it ?
Dmytro Katyukha
firemage.dima at gmail.com
Fri Mar 10 19:44:06 UTC 2023
On Tuesday, 28 February 2023 at 14:29:28 UTC, Mathias LANG wrote:
> ...
Hi!
I like the idea of YAML - it is readable! it is everywhere, we
already have libraries to parse it, it has *aliases and anchors*
that allows to simplify complex configs.
The slowness of parsing yaml is not an argument, from my point of
view, because it will not be parsed too frequently.
But, may be introducing new config format, especially if there a
lot of people that dislike it for some reason, is not a good idea.
In case of config files, i prefer readability. And in this case,
SDLang fits nice - it is readable, and it is easy to work with
it. So i think it is good to keep it.
About JSON (even JSON5) - i think it is not good for
configuration. It is good for serialization, but not for manually
adited configuration files: editing json manualy - is a pain.
Using some hacks to add comments and enable trailing comma is not
good idea.
I think comments are required feature for configs (there are
cases when it is needed to explain why this options is set in
this way and why it must not be changed or removed, or to
describe options in config templates).
If we silently enable JSON5 syntax support for our json files, it
also could lead issues with parsing json files by other tools
(not dub itself). Using json5 as third format? May be we could
find some better config format for third variant of
configuration? Because deprecation of old formats could take
years (there are some packages that had no new releases for few
years, but seems to be working and useful, and i think we must
not break them for no good reason).
Also, i think that it is not good idea to mix package
configuration (description), that have to be read by other tools,
with build scripts (d, lua, etc), that impretatively describes
how to build the app/lib. Thus dub config must not be defined in
any imperative language, instead it must be kept declarative.
So, in my opinion, we have to use YAML or some other
readable/editable config format, or just keep SDLang with JSON
and make SDLang default format for dub config.
More information about the Digitalmars-d
mailing list