On Jan 2, 2008 2:15 PM, David Brown <[EMAIL PROTECTED]> wrote:
> 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.

I don't really disagree with your points, but there is a judgment call
to make which, no matter what, will result in various pros and cons.
Thus is syntax design.

* In my estimation, allowing both tabs and spaces will result in more
users while restricting to just one of those would result in less.

* Not allowing mixture in the same line avoids the worse problems
experienced in the Python community.

* Locking indentation at 4-spaces or 4-displayed-spaces-per-tab
supports "syntax normalization" and fixes the problem you mentioned
above where you have spaces on one line and tabs on another. It does
unfortunately kill tab customization (I prefer 4, you prefer 6, Linus
says only 8 is mathematically possible).

* Yes, this will result in some arguments, *but* (a) there are plenty
of people who already like 4 spaces per tab (as Linus mentioned) and
(b) it keeps the arguments at the hypothetical level because...

Cobra defines tabs as 4 wide in source code.


-Chuck

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

Reply via email to