Fork me on GitHub
#off-topic
<
2016-07-27
>
misha16:07:36

poll: imports indentation 1️⃣

(ns my.app.core
  (:require-macros
    [one.two :as t]
    [three.four :as f])
  (:require
    [one.two :as t]
    [three.four :as f])
2️⃣
(ns my.app.core
  (:require-macros [one.two :as t]
                   [three.four :as f])
  (:require [one.two :as t]
            [three.four :as f]))
Cast your vote !

tomerweller20:07:21

@misha: this is actually an interesting question.

tomerweller20:07:33

As a newcomer to to clojure, I just don’t get vertical alignment. This creates a dependency between naming and indenting. When you change a name, you potentially need to reindent a fuck load of code. Can anyone explain?

mihaelkonjevic20:07:50

@tomerweller: Paredit does a lot of stuff automatically and I just rerun indent-code command on the whole file if needed

mihaelkonjevic20:07:57

(I’m using Emacs)

Bryan20:07:40

and Parinfer does it automatically without having to rerun anything

tomerweller20:07:01

Fair argument but that’s tooling. Imagine you have a widely used function name in your codebase. Refactoring that name, no matter what tools you use, will mean reindenting all function calls. That git diff will be the ugliest ever, for no good reason. You changed one name and reindented hundreds/thousands l.o.c

Bryan20:07:56

That's an interesting point actually @tomerweller

tomerweller20:07:51

Thanks 🙂 My personal preference is that whenever I have a multiple line expression, to have the first argument on it’s own line (like @misha ’s #1 example, which seems to be the less popular one)

misha20:07:06

@mihaelkonjevic automatically re-indenting half of a namespace is bad idea from the "git diff" point of view.