Clojure

Real multi-line comments

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test

Description

The (comment) macro is not a viable substitute for real multi-line comments:

  • It evaluates to nil, so isn't really useful except at the top level
  • It requires proper paren/etc nesting inside itself
  • Contents must be valid tokens; for example TODO: is illegal inside a (comment)

Common Lisp has #|...|# for multi-line comments, and I think Clojure would benefit from having them too. I've implemented #| to behave in a way that is identical (so far as I am able to test) to CL's implementation, and added tests to the reader test to verify that they work.

Apologies for my formatting in the java files not quite matching up with the rest of the code: I didn't want to go through the pain of making it perfect unless this patch would actually be accepted; I can go back through if necessary.

Activity

People

Vote (5)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: