-
Notifications
You must be signed in to change notification settings - Fork 279
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
Should indented comments allow hanging closing parentheses? #259
Comments
Calva doesn't need that placeholder, by the way. It has a special rule to allow a trailing (comment
(range 5)
;; => (0 1 2 3 4)
(interpose '* (range 5))
;; => (0 * 1 * 2 * 3 * 4)
) |
Thanks. Is this correct according to Calva or the Style Guide? If it should be the latter, then the Gather Trailing Parens can be updated to clarify which exceptions are allowed. I suppose it can also take a “no comment” stance, but this can also be interpreted as “the Clojure Style Guide doesn’t allow this”. |
Or you can read my comment as "all style guidelines have exceptions" :) And they are only guidelines not a Standard™️. A trailing paren in a There are plenty of things in the Clojure Style Guide that I don't agree with and don't follow (in some situations). |
Some precedents for when to allow hanging closing parentheses in other Lisps: Riastradh’s Lisp Style Guide
;; Acceptable
(define (foo bar)
(list (frob bar)
(zork bar)
;; (zap bar)
)) Google Common Lisp Style Guide
(eval-when ...
(define ...)
(define ...)
(define ...)
) ; eval-when Racket Style Guide
;; Acceptable
(define turn%
(class object%
(init-field state)
(super-new)
(define/public (place where tile)
(send state where tile))
(define/public (is-placable? place)
(send state legal? place))
)) |
The style guide says to “gather trailing parentheses”. Does this imply that the following is incorrect?
(“rich-comment” example from yuhan0’s comment in Standard Clojure Style discussion)
And the following is correct?
An auto-formatter might make the above correction to follow the “gather” rule, but then might dedent the comment since it’s no longer inside:
Perhaps to avoid this cascade of corrections, should it be recommended to use a placeholder on the hanging closing paren?
Calva uses an
:rcf
placeholder instead.The text was updated successfully, but these errors were encountered: