I'm with you on the column alignment. I don't see how the items in the right column have so much to do with each other that reading down the column is helpful. All that really gets aligned are the opening parentheses, and what's the point of that?
Lining up columns like this can make you crazy. There's a good example of this earlier on the page:
(ns examples.long-aliases
(:require
[clojure.spec :as spec]
[clojure.test :as test]
[clojure.java.io :as io]
[rum.core :as rum]
[diatomic.api :as diatomic]
[clojure.string :as string]
[cognician.chat.util :as util]
[cognician.chat.server :as server]
;; you can use dots in aliases too
[cognician.chat.server.schema :as server.schema]
[cognician.chat.ui.entries.core :as ui.entries.core]))
Here we have two aligned sections, one above and one below the ;; comment. Why aren't they all aligned to the same column? Apparently it's the ;; comment that says "OK, you can stop worrying about alignment here and start a new alignment section below this line."
Now we see another problem with alignment. The sheer amount of horizontal white space makes it hard to visually match up the first several lines that have much names on the left.
And how do we decide what to align and what not to align? We're lining up the :as, but why not the closing brackets too?
Plus, alignment obviously works only in a monspaced font. I like to make my code readable whether someone uses a monospaced or proportional font. If you forgo alignment, code is equally readable in any kind of font.
And really is non-aligned code any less readable than the aligned version? It may not be quite as pretty, by some definition of "pretty", but does it really matter? And it has the advantages of not requiring constant fiddling as you add names, not messing up your VCS diffs, and keeping the left and right parts of the :as close together so you can easily match them up visually?
If you're going to align things I think this is actually the way you should do it, having the alias so far away from the name really hurts readability in my opinion.
Sadly, for me you made the opposite point. The column aligned sections were far easier to see the sections than the other.
Now, I do think this is of rather limited value. So I wouldn't die on this hill. But, column alignment is clearly superior to my subjective eye. It is a shame not everyone has align-regexp.
Could it be a matter of syntax highlighting? I find highlighting draws the subjects out to me better. In my case the :as would be a different color and the closing bracket a muted color, which makes it easy for me to pick out the importing names.
Not for me. My code is syntax highlighted, but I still personally find the aligned code easier to see. The difference is between having all of the stuff side-by-side (vertically) and looking for colours inside other code fragments.
Lining up columns like this can make you crazy. There's a good example of this earlier on the page:
Here we have two aligned sections, one above and one below the ;; comment. Why aren't they all aligned to the same column? Apparently it's the ;; comment that says "OK, you can stop worrying about alignment here and start a new alignment section below this line."Now what if we remove the comment?
Well, that won't do. Time to realign everything to keep it clean: Now we see another problem with alignment. The sheer amount of horizontal white space makes it hard to visually match up the first several lines that have much names on the left.And how do we decide what to align and what not to align? We're lining up the :as, but why not the closing brackets too?
Plus, alignment obviously works only in a monspaced font. I like to make my code readable whether someone uses a monospaced or proportional font. If you forgo alignment, code is equally readable in any kind of font.And really is non-aligned code any less readable than the aligned version? It may not be quite as pretty, by some definition of "pretty", but does it really matter? And it has the advantages of not requiring constant fiddling as you add names, not messing up your VCS diffs, and keeping the left and right parts of the :as close together so you can easily match them up visually?