Why don't we write configuration files in D instead of JSON?

Seb via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 15 23:07:55 PDT 2016


On Thursday, 16 June 2016 at 05:31:26 UTC, Guido wrote:
> It would seem that by running the file through mixin, you can 
> simply create the vars you want in scope. The drawback being 
> random code execution. Is there any way to sanitize mixin code 
> from user-configurable file?

Well it's a configuration file that e.g. the registry has to 
parse too, hence (as for all config files) random code execution 
is pretty bad.
Apart from that it's just about a small configuration file for 
the name, title etc. - you don't need a full-blown D interpreter 
for this.

Imho SDL does a good job at keeping the syntax rather minimal :)

Of course do one stops you to use D to generate a configuration 
file.

> Once that's shot down, does anyone know a .json to .sdl 
> converter program

have a look at  `dub convert` - in your case e.g. `dub convert -f 
sdl`


More information about the Digitalmars-d-learn mailing list