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

Vance Shipley vances@REDACTED
Thu Feb 6 11:46:20 CET 2014

On Wed, Feb 5, 2014 at 9:21 PM, kraythe . <kraythe@REDACTED> 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.

I was inspired by my loathe of emacs indentation to consider how to
solve the style problems completely.  My solution goes a step further
than what is proposed above.  I would keep only the Abstract Syntax
in the repository.  The repository tools (git, svn, etc.) would be
extended to run the appropriate tool (syntax_tools) on checkout/commit.
Each user could have any presentation they wanted.  If you like your
';' before the case clause you get that style 'cause that's what your
tools are configured for.  All style debates would be ended.

On Wed, Feb 05, 2014 at 09:27:35PM +0100, Vlad Dumitrescu wrote:
}  Absolutely, this would fix it. But we don't have tools that can handle
}  that yet and I fear that implementing those and convincing people to
}  use them would take longer than agreeing on a saner alternative for
}  whitespace.

When I first suggested this I was quickly reminded that all preprocessor
information would be lost.  There would be no macros and no comments.

But didn't you solve that problem in Erlide Vlad?  I remember looking
and seeing where you were doing preservation of macros and comments
when working with abstract syntax.



More information about the erlang-questions mailing list