[OT] Spaces/tabs (Was: simple display (from: GUI library for D))

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 11 12:54:26 PDT 2011


On Mon, 11 Apr 2011 06:17:58 -0400, spir <denis.spir at gmail.com> wrote:

> On 04/11/2011 07:51 AM, Jonathan M Davis wrote:
>> the only way that tabs work is if you use them consistently, which in my
>> experience almost never happens. And
>
> How so? If you probably set your editor, inconsistency simply cannot  
> happen... The same is true for using spaces, anyway.

Don't want to get too much into this obviously polarized debate, but in my  
experience, people vary as much as editors.  And editors vary quite a bit.

In most of the editors I use, the default is to use spaces for  
indentation.  So what happens is someone opens a file that uses tabs for  
indentation, then adds some lines.  However, their editor only uses spaces  
*for those lines they added*, which results in a hybrid.  However, the  
person editing doesn't notice because it all lines up on their screen.

You may have philosophical objections to all of this, but this answers  
your question straightforwardly -- it happens, all the time, and this is  
how.

The easiest rule to follow is -- always use spaces to indent.  Almost all  
editors support this (and are set to this by default).  Almost all editors  
provide some sort of auto-indentation, or some command to indent a  
highlighted section of code.  The "oh crap, now I have to go back through  
and convert tabs to spaces" argument just isn't valid anymore.

-Steve


More information about the Digitalmars-d mailing list