
"Marcin Kalicinski" wrote:
I understand that. Comments seem to be much easier to handle than whitespace, but still I think there are plenty of corner cases that we would need to consider, even in such a simple format as INI. For example, how about multiline comments, should they be concatenated into one node, or should each separate line get its own node? How about comments like that:
[Section] key1 = value1 ;comment1 ;comment2 key2 = value2
Where would we store information that comment1 uses the same line as key1? Without it after save it would go to the next line, and be incorrectly associated (by human) with key2.
The general rule is to preserve as much of comments/whitespace layout as only possible. It is not just for human eyes but it gets handy when different versions of the file are compared. The tool should make guesses to which data item a comment belongs - for INI the rules are quite straightforward (I wrote such a tool once). The comments should not be accessible from the application - they are comments and not something application uses. However, it may be useful to be able to /add/ a comment (as "value added on 2006/01/23") programatically. /Pavel