Hacker News new | ask | show | jobs
by amelius 3991 days ago
I don't understand why we should use JSON to configure a server, when a much more powerful language exists: Javascript.

For example, instead of hardcoding some setting in JSON, a Javascript configuration file could perform queries before configuring, or it could install callback functions as part of the configuration.

3 comments

> I don't understand why we should use JSON to configure a server, when a much more powerful language exists: Javascript.

Because it's more powerful. More powerful, in many cases, is a worse thing. Executable imperative code isn't as flexible as a data file because all you can really do with it is execute it and take the output, rather than process it as you see fit.

See:

Rule of Least Power – https://en.wikipedia.org/wiki/Rule_of_least_power

Principle of Least Power – http://c2.com/cgi/wiki?PrincipleOfLeastPower

These articles are phrased as if they are facts. However, they are just some opinions that some people feel are useful.

Take for instance the idea of the "semantic web", where information is stored neatly into proper html tags. It has turned out that this is not a very useful approach to storing information, and nowadays big search engines use machine learning techniques instead to extract the information.

I don't understand why we should use JS to configure a server, when a much more pleasant language exists: Python.

Ultimately, it's not about the language, it's about the simplicity. If you need more that what this does, you can go out and do that, but this looks like a wonderfully simple system where I can just write some information about myself and it uses that to build a site.

there's one more step before that and it is YAML.