On Wed, Jan 02, 2008 at 01:52:28PM -0800, Chuck Esterbrook wrote:

That quote is from http://cobralang.com/docs/hello-world/ and is out
of date. Will fix now.

(1) 1 indent = 1 tab or 4 spaces.
(2) No mixing in the same line (compiler error).

This is still going to be a mess.  Just declaring that a tab is equivalent
to 4 spaces is enough to start religious wars.  A Linux or Unix person will
insist that tabs are 8 spaces.  As an example, quoting Linus:

  Tabs are 8 characters, and thus indentations are also 8 characters.
  There are heretic movements that try to make indentations 4 (or even 2!)
  characters deep, and that is akin to trying to define the value of PI to
  be 3.

The problem is that there aren't really valid reasons to say tab should be
any particular value, so you will always get arguments for different
values.

I suggest you pick one, and just require it.  Guido wishes he would have.

The confusion isn't just tabs and spaces mixed on a line.  Having them
mixed on different lines in a block also becomes ambiguous.

    if expr
        statement
        statement2

If I'm viewing this with 8-space tabs (like most unix-like editors will
default to), statement2 might actually be at the same level as the if, not
as the statement:

....if expr
........statement
<<<TAB>>statement2

An advantage to using tabs always is that the individual can change their
tabstop and get a different indentation amount.

Dave

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to