A way of life goes astray [was: Re: [Rest2web-develop] Changed all references to value "tests" into
Brought to you by:
mjfoord
From: Nicola L. <ni...@te...> - 2005-07-22 08:29:56
|
This will probaby seem completely nuts to you, but please bear with me, I'll try to be concise, *and* offer you a way out of Config Obj *now*. :-D > I think it makes the config files look more confusing. We use > indentation for nesting sections. *so*, you either use what I have done > so far, or you have to indent values *inside* a section. > > Mine (a section indented uniformly) : > > key = value > key2 = value2 > [section] > key = value > key2 = value2 > [sub-section] > key = value > key2 = value2 > > [section2] > key = value > key2 = value2 > > Yours (values indented differently from their markers) : > > key = value > [section] > key = value # if you don't indent here > key2 = value2 # there's no way to distinguish > [sub-section] # this sub-section from section2 > key = value > key2 = value2 > > [section2] > key = value > key2 = value2 > > In your spec values have to be indented more than their section marker > which is equally confusing. Added to which implementing your spec is > *substantially* harder (for no gain IMHO). I beg your pardon in advance. I know you spent much time implementing your style, and then even changed it according to what I asked you (not the above). But what I'm proposing could substantially improve ConfigObj adoption chances, and simplify the code to boot. Thing is, I thought about it, and the only comment I could come up with, about what I replied to this mail of yours, is: "What was I thinking?!?" What I asked you, and you already implemented (not shown above) is inconsistent and arbitrary. What you instead understood, and wrote above, of what I asked, is how things are usually written in an XML file, and in ZConfig pseudo-XML config format too. It *is* probably the best way... ...but maybe all of this is moot. I keep believing that using indentation in config files is a mistake, and I'm going to suggest a way to avoid it. Remember, config files have to go into the hands of not-completely-human beings called "sysadmins". ;-) You can be sure that most of them are *horrified* by the prospect of significant indentation (that's true even of most programmers that have not yet Seen the Light ;-) ). I really think we should leave them free to indent their config files, or not, as they well damn please. I believe that this would be a significant, and unnecessary, barrier to the future adoption of ConfigObj. Let's now suppose instead that indentation is not significant: we still have the problem to signal that a subsection is nested inside the previous one. The XML, and ZConfig, way is to have a section closing marker: it is ugly, unnecessary, and incompatible with straight INI files. A better way, I think, is to have an absolute level indicator in the section marker itself. The marker should be absent at the outer level, to keep compatibility with INI files, and should appear at inner levels. It could be a digit, or a number of asterisks, but maybe the simplest and most obvious thing is to multiply the square brackets, their number showing the absolut nesting level: key = value [level 1] key = value [[level 2]] key = value [[level 2]] key = value [[[level 3]]] key = value [level 1] key = value Obviously it would be illegal to have a level 3 subsection directly nested inside a level one section. We could have an indented-write flag, so that the user could choose to write out the config file in an indented shape: key = value [level 1] key = value [[level 2]] key = value [[level 2]] key = value [[[level 3]]] key = value [level 1] key = value That would be for humans eyes only, the program would recognize any shape, since indentantion is not significant anymore. Again, I understand this means many changes to the code; I hope that it would also allow one to throw away a good portion of it, and that's akways a good thing. :-) I'll make you a deal: if you agree about the above, but are horrified by the work needed to implement it, I propose that you *stop* working on ConfigObj right now, and let *me* implement the needed changes, under your direct control and supervision of each issue as it comes up, obviously. In the meantime, you could go back to work on rets2web, or whatever is waiting for your attention. Once I complete the rewriting, you would step back in, add the still missing features, wrap it all up and release it into the world. :-) I know it takes a good deal of trusting, but I would ask you for any structural change I'd make, and you have control of the repository anyway, so what have you got to lose? :-) -- Nicola Larosa - ni...@te... When I was growing up, my parents used to say to me, "Tom, finish your dinner - people in China are starving." But after sailing to the edges of the flat world for a year, I am now telling my own daughters, "Girls, finish your homework - people in China and India are starving for your jobs." -- Thomas L. Friedman, New York Times, April 2005 |