3 ms·
Anybody that wants turing complete programmability in their config file is asking for pain. You can always embed such a language in a string as an escape hatch
by emn13 8y ago
Anybody that wants turing complete programmability in their config file is asking for pain. You can always embed such a language in a string as an escape hatch, so there's no loss of generality in any case, but it's sufficiently painful to encourage simplicity and security. But there exist computation models weaker than turing completeness that are still useful, some of those might be reasonable in a configuration file format. For example, you might want to specify a bunch of things iteratively, or perhaps with some fixed number of temporary variables; that's merely an FSM. Or even simply plain non-iterative logic with parameter passing, which is even easier to reason about and possibly still useful; i.e. re-usable templates without iteration or recursion.
I can at least imagine such a configuration file format could be both simple enough for human and machine to reason about, and flexible enough to add value over (say) json. But the devil is in the details; and it's not always immediately obvious what's too complex.
In any case, json5 looks like what json should have been from day 1; several of the really critical improvements were common JS practice when json was invented.
I'm a little worried about the IdentifierName extension, since that's more than what javascript itself allows (no reserved keywords!).
But json5 is also an interoperability problem. The nice thing about a (good) standard is the that if it works someplace, it'll work anywhere. Add json5 into the mix, and that's not the case anymore.
Then again, there aren't a huge number of plausible successors to json, so maybe this is the best we can hope for. And it's trivial to down-convert to plain json, which means it's not too bad, I guess?
I wish json5 simply worked everywhere ;-).
- whateveracct 8y agoDhall is a good example of a "programmable" configuration file format. It's based on System F, which means you get no-nonsense abstraction (in the LC sense) without any pain. It really helps to be built on something conceptually robust instead of ad-hoc whims. Oh and it has a static type system. Quite nice!
- azernik 8y agoI find HOCON to be a nice minimal extension to JSON - allows config values to reference each other, with some basic string and array functions included, and allows successive files to append to or override existing config values. Fills 90% of what I see people asking for in terms of programmability. https://github.com/lightbend/config/blob/master/HOCON.md#goals--background https://github.com/lightbend/config/blob/master/HOCON.md#goa...
- h1d 8y agoIt's hard to believe json standardized without comment section and everything json5 fixes. TOML is fine.
- emit_time 8y agoIt's easy enough to get Turing complete config files with LISP shivers