Arc Forumnew | comments | leaders | submitlogin
2 points by rocketnia 4557 days ago | link | parent

"Comments are versatile. Perhaps we need two kinds of comments that can be colored differently."

This exactly. If you expect programmers to read and edit code under a particular kind of interface, such as text with a particular kind of syntax highlighting, it would make sense to judge readability in terms of that interface.

Anyway, the two-comment idea seems to happen for me already! I always write "NOTE:" or "TODO:" when my comment isn't just a narrative explanation or other straightforward hand-holding. In Java and JavaScript, TODO (if not NOTE) is commonly highlighted in a more prominent color.

Even without highlighting, I think it helps that my "NOTE:" and "TODO:" labels are in capital letters. :)

While the idea may exist in practice (at least for me), that doesn't mean the language can't take it further. IDEs with code folding support tend to support folding of comments too. A language with long-form and short-form comment syntaxes might provide an option to toggle all long-form comments within a single block of code, while leaving the short-form comments alone. (This might just make it easier for people to forget to keep the comments up to date, but maybe code edits could trigger a red highlight around the comments as a reminder.)

---

"Are there still other uses for [comments]?"

The uselessness of comments often makes them useful, in a self-defeating cycle. :-p http://c2.com/cgi/wiki?HotComments But I guess we're focused on different ways comments can be used for documentation.

Javadoc, Docco, and inweb handle HTML, Markdown, and TeX in comments. Unlike syntax highlighting, these tools have a compile step (and may erase details that are visible during maintenance), so there can be a struggle between readability at the maintenance side and readability at the publication side. Last time I used JsDoc, I think I wrote at least one comment describing how the formatting worked for another comment.

The code for Docco, as rendered by Docco: http://jashkenas.github.com/docco/

The code for inweb, as rendered by inweb: http://inform7.com/sources/src/inweb/Woven/index.html

Mathematica goes to the trouble to provide rich visual notation for code itself, but it doesn't appear to innovate in the realm of rich WYSIWYG comment formatting. It just has monospaced inline comments and the ability to render "text cells" of explicit markup:

http://reference.wolfram.com/mathematica/tutorial/Documentat...

http://reference.wolfram.com/mathematica/tutorial/TheStructu...

Meanwhile, Inform 7 code is enough like English that it might as well be edited in a word processor. A language IDE could potentially start with the comprehensive text-managing complexity of a word processor, and then add code-specific functionality like error highlighting, autocompletion, and interactive visualizations.

(Hopefully those code-specific features will clarify the shape of the formal model underneath, rather than just showing layer upon layer of sugar, but I digress.)