What is the Lisp convention about how many semicolons to use for different kinds of comments (and what the level of indentation for various numbers of semicolons should be)?
Also, is there any convention about when to use semicolon comments and when to use #|multiline comments|# (assuming they exist and exist on multiple implementations)?
In Common Lisp:
Note: Emacs doesn’t fontify
#| |#very well, but as Rainer suggests in the comments, try using#|| ||#instead.I’d say there are no rules to use this one, but I reckon it’s faster for commenting huge amounts of code, or to insert some long description where the semicolons just get in the way of editing, like huge BNF listings or the like.
There’s a neat trick to disable code which is to prefix an expression with
#+(or):Note:
#+nilusually works too, unless you happen to have anilor:nilfeature. The advantage of#+(or)is that you can edit it easily by either commenting it out or change it to#+(and), or to actually include a set of features upon which you really want that expression to be read.SLIME helps here by fontifying the form
(do-something a)as a comment when you have a Lisp running.Apart from Common Lisp’s particular commenting syntax and tricks, such as
#| |#and#+(or)or the more commonly seen#+nil, I believe the semicolon rules are widely adopted in other lisps too.Here’s an excerpt from the specification, note how current practice has diverged regarding the single semicolon: