Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heading, top-level, and trailing comments #29

Open
uvtc opened this issue Jan 8, 2013 · 3 comments
Open

heading, top-level, and trailing comments #29

uvtc opened this issue Jan 8, 2013 · 3 comments

Comments

@uvtc
Copy link
Contributor

uvtc commented Jan 8, 2013

Re. "The only comments in which omission of a space between the semicolon and the text is acceptable are margin comments."

Leaving out the space there looks bad, IMO. I don't think that should be in the style guide.

Also, where does the tradition of triple and quadruple semicolons come from? Is that from Elisp? The only Clojure project I know of that reads comments --- and does something with them --- is Marginalia. AFAIK, it treats full-line comments as markdown input, and uses the double-semicolon throughout. For example, see https://github.com/fogus/marginalia/blob/master/src/marginalia/core.clj .

If anything, I'd recommend that comments be written in such a way as to be correctly renderable by Marginalia (I haven't looked into how it handles triple and quad semicolons).

@uvtc
Copy link
Contributor Author

uvtc commented Jan 8, 2013

Incidentally, and related to this topic: where you, for example, have

;;; object creation
;; good
(java.util.ArrayList. 100)

;; bad
(new java.util.ArrayList 100)

;;; static method invocation
;; good
(Math/pow 2 10)

;; bad
(. Math pow 2 10)

I'd be tempted to make that:

;; ## object creation
;; good
(java.util.ArrayList. 100)

;; bad
(new java.util.ArrayList 100)

;; ## static method invocation
;; good
(Math/pow 2 10)

;; bad
(. Math pow 2 10)

such that "object creation" and "static method invocation" now look more like (H2) headings (both to the reader, and to the marginalia parser). :)

@bbatsov
Copy link
Owner

bbatsov commented Jan 8, 2013

The tradition dates back to Scheme AFAIK and is considered the facto standard in every Lisp. The margin exception rule is pretty common and I basically copied it from the Scheme style guide, but I dislike it as well and I'll probably remove it soon. I do like the triple and quadruple comments - they carry semantic information and that's not a bad thing.

@uvtc
Copy link
Contributor Author

uvtc commented Jan 8, 2013

The tradition dates back to Scheme AFAIK and is considered the facto standard in every Lisp.

My guess is, that tradition may be changing with Clojure (just my 2 cents). I very much like the idea having comments in markdown. This way, if I'm away from some code for weeks/months, and want to quickly come to terms with it, I can have Marginalia process it and read through nicely-rendered (as html) comments side-by-side with the code. (Likewise, if I'm learning my way around someone else's code.)

If there were another popular tool like Marginalia which maybe rendered ";;; foo" ---> <h2>foo</h2>, ";;;; foo" --> <h1>foo</h1>, I could imagine the repeated semicolon syntax maybe being useful, but it's still problematic:

  • for one thing, I have to count semicolons
  • for another, there's no h3 (unless you make ;;; --> h3, ;;;; --> h2, ;;;;; --> h1).

Seems to me markdown is preferable to that. And also, many folks generally use some markdown in comments already (italics and code, for example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants