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

Alan Malloy made changes -
Field Original Value New Value
Attachment 0001-Add-multi-line-comments.diff [ 10078 ]
Alan Malloy made changes -
Attachment 0001-Add-multi-line-comments.diff [ 10078 ]
Alan Malloy made changes -
Attachment 0001-Add-multi-line-comments.diff [ 10079 ]
Stuart Halloway made changes -
Priority Major [ 3 ] Minor [ 4 ]
Waiting On richhickey
Rich Hickey made changes -
Waiting On richhickey
Chas Emerick made changes -
Status Open [ 1 ] Closed [ 6 ]
Resolution Declined [ 2 ]

People

Vote (5)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: