inamidst.com · patterns

Hot Comments

(Note: I've been having lots of people reaching this page via Google recently, but I've no idea why. If you'd like to spare a few moments to tell me, I'd greatly appreciate it! Thanks.)

What are Hot Comments?

Hot comments are what you get when you subvert language documentation facilities for other purposes. For example, the Creative Commons project embeds RDF inside HTML by putting it in comments. It's generally a bad thing when you embed data inside a comment because you can only tell what type of content it is by using heuristics. Did the author mean to assert the RDF inside an HTML hot comment, or is it there as an example, or something else? I'm not held to it by specification, just by common sense; but so much for common sense, as Stephen Hawking says. "Common sense tells us that the sun goes round the earth." Another kind of hot comment is the shebang, only the convention there is so strong that it became specified formally.

The ostensible purpose of a comment is for documentation. Richer documentation, even if it's machine readable, doesn't constitute a "hot comment" because that's still sticking to the ostensible purpose. So Comments.pm and doctest aren't hot comments.

Hot comments, then, are a kind of forward extensibility. When a language doesn't provide the means to be augmented in barely forseeable ways, existing facilities such as comments have to be subverted for the task in order to provide a compatible route forwards. Hot comments are therefore more a consequence of the design of the original language than any nefariousness on the behalf of its later users.

Other examples of hot comments, contributed by Daniel Biddle, include SSIs, modelines (the -*- encoding: utf-8 -*- sorts of things that emacs and vim use to figure out certain per-document settings), conditional comments so beloved by Microsoft especially for browser detection, and FP webbots.

Notes


Sean B. Palmer, inamidst.com