Thoughts on language-level configuration support?
kay.schluehr at gmx.net
Tue Mar 31 11:57:40 CEST 2009
On 30 Mrz., 15:40, jfager <jfa... at gmail.com> wrote:
> I've written a short post on including support for configuration down
> at the language level, including a small preliminary half-functional
> example of what this might look like in Python, available athttp://jasonfager.com/?p=440.
> The basic idea is that a language could offer syntactic support for
> declaring configurable points in the program. The language system
> would then offer an api to allow the end user to discover a programs
> configuration service, as well as a general api for providing
> configuration values.
> The included example implements the first bit and hints at the third,
> defining a function that looks up what variable its output will be
> assigned to and tries to find a corresponding value from a
> configuration source. It's very preliminary, but I hope it gives a
> flavor of the general idea.
> Any thoughts or feedback would be greatly appreciated.
The problem with your idea is that those declared declaration points
can be overlooked no matter how much syntactical support is added.
Lets say a resource file is loaded and there are a few of the config-
properties declared in modules you have written. Now an object wants
to access a resource defined in the file and fails because the
resource providing property could not be found since the property
defining module wasn't loaded yet and the property couldn't register
itself. That's why things are centralized as in optparse and the
workflow is designed upfront or things are implemented locally and
individual units have to take care of their own.
More information about the Python-list