Subject: Re: proplib changes
To: NetBSD Kernel Technical Discussion List <tech-kern@netbsd.org>
From: matthew sporleder <msporleder@gmail.com>
List: tech-kern
Date: 06/28/2007 17:41:33
On 6/28/07, Greg A. Woods <woods@planix.com> wrote:
> At Tue, 26 Jun 2007 09:03:09 -0700, Jason Thorpe wrote:
> Subject: Re: proplib changes
> >
> > On Jun 26, 2007, at 3:17 AM, Trevor Talbot wrote:
> > >
> > > 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.
> >
> > comments are just that -- comments.  They are semantically
> > meaningless, and so, while the parser can handle normal XML comments,
> > the comments do not appear in the resulting dictionary.  Since they're
> > not in the dictionary, when the dictionary is once again externalized,
> > there obviously won't be any comments.
>
> Yes, but if you're translating a "document" between different languages
> then the comments MUST be preserved, and in the appropriate context.
> They might not be part of the data used by the machinery, but they are a
> critical part of the data used by the human.
>
> > Not that this matters much -- generally, the keys used in a dictionary
> > should be chosen so as to be descriptive, and nothing is a substitute
> > for good documentation on the schema used by any given application.
>
> I can't believe you said any of that!
>
> The comments aren't usually/only going to be there to describe the
> option or its possible values or such -- they're going to be there to
> tell the next guy who edits the file why the particular setting has been
> chosen on the particular system, and what the consequences might be of
> changing it for that particular system.
>
> Comments MUST be supported both in any plist specific management tool
> (your "pedit") and in any tools intended to translate between various
> formats.
>


If XML were the exclusive language of plists, then keeping comments
around would be as easy as adding sax/dom to netbsd.  Additional
formats that use a different comment syntax would make things
difficult as you'd need routines for each one to change data without
affecting the rest of the document.  (system("sed s/foo/bar"); ?)

XML has established methods to change data in a document without
losing anything, whereas #commented or *commented or :commented files
do not.  This is one of the reasons why it is such a great compromise
between human-editable and machine-editable.

Maybe this sort of flexibility should be required of a plist syntax,
as I don't think storing comments in the running kernel is desirable.