[erlang-questions] Controversial subject of the day: tabs and spaces for indentation

Vlad Dumitrescu <>
Wed Feb 5 21:37:19 CET 2014

On Wed, Feb 5, 2014 at 9:28 PM, Garrett Smith <> wrote:
> On Wed, Feb 5, 2014 at 2:21 PM, kraythe . <> wrote:
>> Actually the solution to this age old debate was proposed to me by a friend
>> of mine and its genius on a number of levels but isn't implemented anywhere.
>> The reality is that for most languages whitespace is irrelevant so it
>> shouldn't be the code holding the indentation but the user's preference
>> file. Imagine a source code repository where there is NO irrelevant
>> whitespace in the code base. For java, for example, there would be literally
>> only one single line of code. Now when you check out you have a preference
>> file that says you want tabs or spaces or mixed and also defines the other
>> formatting you prefer. When you check out the system reformats the code
>> according to your specs dynamically. When you commit, it strips your code of
>> whitespace before comparing.
> Heh, not bad. I wonder how something like this might evolve.

Actually, if you have two scripts that add/remove whitespace (for now
I'd keep the newlines so that diff gives better results) you could
hook them into git's pre-commit and post-checkout hooks. I don't know
which other VCS allow this.

Of course, this will require everybody to have converters for all
languages (one doesn't know what might be in a repository). Maybe git
could have special hooks that are actually stored in the repository,
so one can get them from there?


More information about the erlang-questions mailing list