caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hendrik Boom <hendrik@topoi.pooq.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Coding style: mixing tabs and spaces in indentation
Date: Tue, 5 Jan 2016 16:25:33 -0500	[thread overview]
Message-ID: <20160105212532.GE31106@topoi.pooq.com> (raw)
In-Reply-To: <20160105091224.GA10087@pl-59055.rocqadm.inria.fr>

On Tue, Jan 05, 2016 at 10:12:24AM +0100, Sébastien Hinderer wrote:
> Dear all,
> 
> I am wondering whether there are some guidelines that have been proposed
> regarding the way OCaml code should be presented?
> 
> More specifically: am I correct that it is considered not such a good
> practise to mix tabs and spaces in code indentation? And if so, are
> there objective reasons for that?
> 
> It seems Emacs is configured to do that (mixing tabs and spaces) by
> default, can anybody confirm?

It used to be (I'm talking 1960's and 70's here) that the standard was 
for a tab to be  equivalent to eight spaces.

No problem mixing tabs and spaces then.

But when people started programming a lot in C instead of assembler, 
the problem arose.  The recommended style was to use tabs for 
indentation.  The result was functions with very short lines of actual 
code when control structure was significantly nested.  Of course the 
style gurus would say that you had to break functions up at that point 
and that this wasa a useful indication that your indentation was too 
deep.  But many thought differently about style and started to indent 
less aggressively, perhaps two, four or even three spaces for each 
indent.  And to make that easy, they would set tab stops accordingly.

The result was that if tabs and only tabs were used for indentation, it 
would format nicely whatever your tab stop settings, and if spaces and 
only sppaces were used, it would also format nicely.  But if they were 
mixed, you would get a total mess if the tab width in the display were 
diffferent for that used when coding.

-- hendrik


      parent reply	other threads:[~2016-01-05 21:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05  9:12 Sébastien Hinderer
2016-01-05  9:18 ` Francois Berenger
2016-01-05  9:34 ` David MENTRE
2016-01-05  9:55 ` Raphaël Proust
2016-01-05 13:46 ` Christophe Troestler
2016-01-05 15:36   ` Drup
2016-01-05 15:42     ` Simon Cruanes
2016-01-05 21:25 ` Hendrik Boom [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160105212532.GE31106@topoi.pooq.com \
    --to=hendrik@topoi.pooq.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).