Subject: Re: proplib changes
To: None <tech-kern@netbsd.org>
From: Trevor Talbot <quension@gmail.com>
List: tech-kern
Date: 06/26/2007 03:17:58
On 6/26/07, John Nemeth <jnemeth@victoria.tc.ca> wrote:
> On Nov 15,  7:41pm, "Trevor Talbot" wrote:
> } > > On 6/25/07, Thor Lancelot Simon <tls@rek.tjls.com> wrote:

> } > > >What harm is done if we have 8,000 different syntaxes, if the tools do
> } > > >seamless conversion between them all?

> } But the issue is what happens when there's an existing configuration
> } file I want to edit.  If it's in one of the 7,999 formats I'm not
> } comfortable with, I have to use another tool just to get it into a
> } form where I can edit it.  (And there's still the issue of
> } transporting comments in this case.)

> As for comments, I don't know if plists allow for them.

Plists are XML, so yes -- XML comments.  It appears SCN supports
comments too, but proplib doesn't.  I don't think it necessarily
should, but you can't write an effective converter without dealing
with this issue somehow.  Losing user-defined information in a
for-humans format is not cool.

> } It doesn't matter that the particular application can read any format,
> } or that proplib provides the ability to write any format (it's
> } unlikely all the proplib users will expose that), if I still have to
> } jump through hoops just to make simple configuration changes.

>      There is nothing for the "user" to do.  An application simply
> calls prop_dictionary_internalize_from_file(<path to file>);.  proplib
> will open the file, read the beginning of it to determine the format,
> parse the rest of the file into a dictionary, and finally return a
> prop_dictionary_t to the application.  If the application wants to
> write a file all it has to is call
> prop_dictionary_externalize_to_file(<dictionary>, <path to file>);.
> proplib will look for an environment variable specifying the preferred
> format, select the default format if the environment variable doesn't
> exist, and create the file in the specified format.  One of the main
> features of proplib is that the application doesn't need to concern
> itself with parsing or creating the external format.  This is handled
> completely by the library.

That's true *if* the application decides to write to a file.  Are you
suggesting it be mandatory for all applications to support a switch
that has proplib read a configuration, then immediately write it out,
without doing any other application logic?  (I can't fix a "broken"
configuration file if I can't understand it.)

That doesn't make things any better, though: now not only do I need to
figure out that I need to convert a format into the one I want, I also
have to figure out the magical invocation for every application to
make it do that for me.

Scenario: an application comes with an example/template configuration
file that the user must edit.  What format is it suppplied in?  How
does the user convert it to the format they have chosen for the rest
of their system?  Is there some new "installer" mechanism to do this
consistently for all applications?