3 ms·
I'm amazed we still use configuration files like that. Why not have some capable programming language (python, javascript) handle the configuration? This would
by amelius 12y ago
I'm amazed we still use configuration files like that. Why not have some capable programming language (python, javascript) handle the configuration? This would let one more naturally describe things, and will eventually reduce the possibility of obscure configuration commands that do one very specific thing, and hence lead to frustration when the user needs something slightly different. Using a programming language, one could even configure using callbacks, etc. and is much more flexible.
- m0th87 12y agoI'm not a lisper, but this makes me pine for some universal, maybe lisp-like language. It's a total waste of time to learn a new config syntax for each application.
- gjggkjasdf 12y agothe ironic thing here is that Lispers fucking love sticking new DSLs wherever they possibly can. And I imagine most developers of these pet config files would argue the same thing. Unfortunately. It was Microsoft of the 1990s that surprisingly brought some sanity to the table, with INI files. I'm glad tools like Git use this format.
- ams6110 12y agoThen they threw sanity out the window with the registry.
- throwaway2048 12y agoThis is getting pretty offtopic, but this is what GNU has tried to do with guile https://en.wikipedia.org/wiki/GNU_Guile https://en.wikipedia.org/wiki/GNU_Guile
- catwell 12y agoLua is often used for that purpose. It is not a Lisp but it fulfills this role well enough.
- RexRollman 12y agoThe choice of configuration file is described in the PDF: "The httpd.conf configuration file is using OpenBSD's modern style of a sane cofiguration language, that attempts to be exible and humand-readable. It does not use a markup with semicola or tags, just english keywords and blocks identified by curly braces (\ fg"). This is commonly called the parse.y-based configuration within OpenBSD, because it originates from the grammar and parser that was written for pf."
- amelius 12y agoBut still, the developer of the configuration file format has to think of all possible use-cases of httpd. It seems to me that life for the developer, as well as the user, could be much simpler with a programming language instead.
- woodman 12y agoCan you give an example of a config file being used for what you're describing? Because I've always written software to treat config files like #defines that don't need a recompile, and maybe setup a variable number of strictly defined structs.
- twic 12y agoIf your application is written in a language that could be used as a configuration language, then this is quite simple. I've come across it in Ruby and Python - for example, Ruby's rackup config file is Ruby code: https://github.com/rack/rack/wiki/%28tutorial%29-rackup-howto https://github.com/rack/rack/wiki/%28tutorial%29-rackup-howt... However, if your application's language is not suitable for use as a config language, then this becomes significantly more painful. You have to link in an interpreter for the configuration language, and then expose your application's internals to the interpreter. The easiest this could be is probably using JavaScript as a configuration language in Java, because the Java runtime already includes a JavaScript interpreter which can reach into the Java object model. The hardest it could be is using pretty much anything with C, where you'd have to add a separate interpreter, and then expose all the relevant internals by hand.