Re: How many spaces a tab is worth David Allouche 01 Dec 2003 18:53 UTC

On Mon, Dec 01, 2003 at 06:45:03PM +0100, RedHog (Egil Möller) wrote:
> Actually, I was myself very doubtfull about including support for TABs
> at all - I never use TABs in any language and find them uggly.
> However, having TAB et hard to 8 would make it very unusefull - a
> normal Scheme program would indent off of the right screen-border in
> five milliseconds...
>
> Anyway, not using spaces but only TABs would lead to the above
> mentioned indentation off of the screen, and as the Python PEP states
> it:
>
>     Never mix tabs and spaces. The most popular way of indenting
>     Python is with spaces only. The second-most popular way is with
>     tabs only.
>
> after a second thought, I think TABS should be totally dissalowed -
> that eases a lot of things, and nothing is lost by removing them in
> terms of expressivity or readability.

That is the lazy programmer option and my guts aprrove it.

But to be really convenient, it would be necessary to do as Python.
Generally, I think those people can be trusted on having already
thouroughly thought out the question, so "do as Python do" should be the
rule of thumb (unless for what they do for historical reasons, backward
compatibility, etc.)

Indentation-based syntax is going to be used by cl00less n00bies ;-) And
such users would be very disappointed if the software rejects their text
because they have used tabs (or because they use a wrong text editor).
If I understand well, this SRFI is about stopping these people saying
Scheme has too many parentheses... so it is aimed mainly at newbies.

Also, TAB may be used as a form of compression for leading spaces. I am
not quite sure of how Python handle this... for example

define (prime? n)
    let next
< tab > block
< tab >     m (inexact->exact (sqrt n))
< tab > if (< m 2)
< tab >     #t
< tab >     and
< tab > < tab > not
< tab > < tab >   divider? m n
< tab > < tab >   next (- m 1)

(mathematical correctness not garanteed)

It may be reasonable to reject such input. I have just not made up my
mind on this. As long as the document is entirely consistent, that is
easy to handle (just consider tab >> space) but once someone replace a
tab by several spaces we get into trouble.

Also, when the editor is set to display tabs in a reasonably way (as
four or two spaces) it is quite natural to use TAB-only indentation.
This is far more convenient that typing all as space on stupid editors.

Many students actually type their source code in Notepad on Windows and
paste it in a Telnet because their teachers showed them vi and their ran
away screaming in horror... I've seen it...

But then, after all, why bother?

PS: you should use the "reply to list" or "relpy to all" feature of your
mail client, so your answers go the discussion archive (and are visible
by other interested people).
--
                                                            -- ddaa