4 ms·
The problem with comments: suppose I build a config UI to edit the configuration file using fill-in-forms. How do I display the comments in this UI? I can't dis
by skissane 8y ago
The problem with comments: suppose I build a config UI to edit the configuration file using fill-in-forms. How do I display the comments in this UI? I can't display classic line or block comments easily, because it isn't always clear which setting the comment is attached to.
The author says something like "__comment" is ugly for humans editing the file. Sure, it is. But it works much better if the file is also going to be edited by a UI. (Although "__comment" can comment the object but not an individual key; something like "name#comment" being comment on "name" key and "version#comment" being comment on the "version" key could permit separate comments on each key.)
I actually am encountering a similar problem at work right now. We have a complex XML config file. Some people edit it via an XML editor, others edit it using a fill-in-form UI. With the fill-in-form UI, we'd like to display (and permit editing of) the XML comments, but it isn't always possible to work out programatically which XML element(s) the comment is talking about.
Compare:
<!-- The following setting is blah blah blah -->
<foo-setting>32</foo-setting>
<bar-setting>64</bar-setting>
with:
<!-- Email Configuration Section -->
<mail-host>mail.example.com</mail-host>
<mail-port>25</mail-port>
In the first example, the comment belongs the immediate subsequent XML element only. In the second example, it belongs to both of the following elements. There is no reliable way to distinguish these cases, unless you try to interpret the natural language text of the comment itself (which can't be done with perfect reliability).