[Tutor] tabs or spaces (the endless debate!)

alan.gauld@bt.com alan.gauld@bt.com
Mon Feb 17 08:32:02 2003


> > tab character is a fixed, known ascii character around the world.

Thats true, but how it should be rendered isn't.
For example FrameMaker uses the interesting technique of setting tabs 
by their physical distance from the left margin. You set tabs in 
inches or centimeters! This results in a very different display of 
two tabs than I get in vim, say.


> > line is to be indented once. With two, you know 
> definitively that line is to be indented twice, etc. 

In Frame one tab means the line starts 1 cm from the margin, 2 tabs 
means it starts 2cm in etc... How many characters that translates 
to depends on which font you use!

Incidentally Frame does this because its a WYSIWYG environment and
wants tabs to line up regardless of the fonts you use, whether italics 
are on etc. So physical distance is the best way to do that for Frame, 
but it can often look wierd when you import python code.

> With spaces, they may be damaged during transport from mail 

Why are spaces any more prone to damage than tabs?

> Because if you write your code to wrap at 79 chars (which is a good 
> idea for readability) then whether a tab is 4 or 8 chars matters (and 
> diff't environments use diff't sizes for tabs).

Absolutely. Also when you open code in an editor its not obvious 
whether the code is indented with tabs or spaces. If you then try 
to add some new code, inside a loop say, and use the wrong chacter 
your code breaks! Better if we all stick to spaces for distributed 
code IMHO.

Alan g.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld/

PS 
My web tutor server was down for a few days, its back now, sorry!