On Mar 31, 5:57 am, Kay Schluehr <kay.schlu...@gmx.net> wrote: > On 30 Mrz., 15:40, jfager <jfa...@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.
What is a resource file? How am I accessing the "resource-providing property" of an unloaded module? That is, if a module isn't loaded, how do I know about its properties? Or conversely, if I know about its properties, why isn't the module loaded? In other words, why would accessing a configuration point be any different than accessing any other name in a module? -- http://mail.python.org/mailman/listinfo/python-list