[MLton] Tabs in source files

Stephen Weeks MLton@mlton.org
Tue, 26 Jul 2005 15:37:21 -0700

> I don't want to start a holy war, but I would like to suggest not
> using tabs in source files.

I have no strong feelings either way.

> The main problems with tabs are broken indentation (with different
> tab widths) and unnecessary (pure indentation) diffs.

I understand both of these, but don't see them as a huge deal.  It
seems equally reasonable to mandate that developers use 8-space tabs
as it is to mandate that they not use tab characters.  The MLton
project isn't big enough to have encountered significant problems with
indentation diffs.

> The savings in source code size offered by tabs is unlikely to be
> important

To inject a little data into the discussion, here are some stats on
the HEAD of the MLton sources (obtained via cvs export mlton).

du -s currently reports 18944.  There are 2,326 ASCII files and 1
binary file (gdtoa.tgz).  There are 1,322 ASCII files with tabs,
containing a total of 354,944 tabs.  Replacing all of the tabs with
eight spaces will add 2,484,608 bytes.  After doing the replacement,
du -s reports 21396.  So, the space increase to the HEAD revision is
about 13%.  Not a big deal.

> and should not have a significant effect on the speed of
> something like CVS operations when using compression.


> MLton is, of course, a different project and I'm biased as I personally
> don't use tabs and have set
>   '(indent-tabs-mode nil)
> in my XEmacs custom.el 
> In Emacs, you could probably use hooks (e.g. sml-mode-hook) to turn the
> option on/off depending on mode.

I use XEmacs 21.4, and adding "(setq indent-tabs-mode nil)" to my
sml-mode-hook worked fine.

> CVS has a feature to run pre/post commit scripts. I have previously used
> a script that rejected commits containing tabs and automatically removed
> trailing whitespace (to keep the sources clean).

It would be worth having such a script if we make this change.

Since the arguments in favor are reasonable and we seem to have one
strong push, I'm inclined to do it, provided no one seriously objects.