D
David Stanek
In message <36148830-22c0-4f19-ab23-
If you're advocating anything resembling php.ini, you deserve to die.
I am pretty sure that is uncalled for.
In message <36148830-22c0-4f19-ab23-
If you're advocating anything resembling php.ini, you deserve to die.
By magic: see later
There is actually. The reason is that those different configuration
interfaces are actually accomplishing different things. You're lumping
together both config files (wherever they may be and whatever format
they may be in) with command line parameters and GUI command interfaces
when the one is providing long-term defaults and the other short-term
overrides.
The level of detail that you can have in a config file is something that
you never want to see on a command line. When you do, as with say "gcc",
the results are rather mind-numbing. This distinction is something that
your reduction of configuration to a single black box fails to capture.
Yes you do. This spread-about inline style of configuration is in no
sense discoverable to the casual reader, who isn't going to know that
a particular config option even exists unless he or she chances upon
the line where it's registered.
I'm not commenting on your code
snippet here -- or I'd be here all night, and you really wouldn't
like me at the end of it --
but I am commenting on the usage style
it's obviously built to support. That usage style is much less
visible than any of the common (or uncommon, for that matter) styles
of getting config input, and discourages documentation habits that
would otherwise mitigate it.
As I said, it's less visible because it's decentralised. The moment
you do that, you lose all hope of centralising the documentation, and
the visibility of your options plummets.
What "discoverability"? You still haven't told me anything to make
me believe that this configuration setup is discoverable at all without
external tools.
It remains magic when it requires the language to invent things on the
fly that the programmer has no means of discovering until the code is
running, by which time it's generally too late. For example:
spam = conf(1)
How does that translate into a command-line option? -s? --span?
Both? -S, even? --first-config-option-I-came-across? If the first,
what happens when:
span = conf(0)
shows up to initialise a class attribute some time later? What
restrictions can be put on the value you get back? What can the
help system say about this, or do we have to go back to doing all
that by hand? Now translate all those questions into the very
different environment of a config file. Repeat with a database,
and all it's quirks. By the time your colossus has acquired
enough parameters to at least hint at the desirable answers to
these questions, you've effectively duplicated the interfaces to
all of the config mechanisms you're trying to replace and you've
still lost a whole heap of flexibility.
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.
conversation: "Program, tell me all the things I can configure about
you" - "Okay, here they all are". No digging through the source
required.
But this doesn't have any particular meaning. If I run a dir(obj)
command all attributes of obj will be returned and I can be sure these
are all. In C# I can reflect on attributes of an assembly which is a
well defined entity. "Program" is not an entity. It's kind of a user
interface name in StarTreck ( which prefers "computer" for this
purpose though ). This way we cannot design systems.
"Module and transitive graph of other modules (constructed through
'import' statements), tell me all the things I can configure about
you". Is that a little clearer?
clear and easy way to do it, that it should be considered a basic
service, and that if the best way to satisfy all the goals is to
integrate it directly into the language, that shouldn't be shied away
from.
The example that I have on my blog post, I consider that 'syntax',
even though it's implemented as a function, mainly just because it
digs into the bytecode and modifies the normal way a function is
evaluated (the function's value is determined by where the output
would go).
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.
Honestly, the programming language and the configuration languages
should never, ever, ever be inseparable. I don't see a reason for
it and I see some great reasons not to do it.
I don't particularly see why this is needed.
To my mind the strongest
argument you are making, by far, is the "discoverable" argument. If
you were able to build a system which permitted other components to
discover configuration options and give configurable levels of
permanence and visibility to them, that would be great. If you were
able to do it and make it easy for a programmer to interact with, you
would most definitely have a module I would use. But I daresay you're
going to have to build it (or at least mock it up) before you're going
to get a lot of folks jumping on the bandwagon, and its a *long* slog
before you hit the level of support and stability you're going to need
to convince folks to trust their precious config files to it.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.