Tabs vs Spaces

As I see it there are three camps, each with a decreasing level of wrongness.


First camp:
Only tabs.  This is about as wrong as you can get.  Start with:

 class MyPen
{
<tab>public void Method1(int i, 
<tab><tab><tab><tab><tab>string s)
}

That's pretty useless.  Go to someone who doesn't have 5 deep tabs (say 8) and you'll get

 class MyPen
{
<tab   >public void Method1(int i, 
<tab   ><tab   ><tab   ><tab    ><tab   >string s)
}

Wrong wrong wrong.  Alignment is totally destroyed


Second camp:
Only spaces. Still wrong, but not as bad as all tabs.
Start with:

 class MyPen
{
........public void Method1(int i, 
............................string s)
}

Now go to somebody who really hates deeply indented code and wants thinks only indented 2 deep instead of 8 deep?  What can they do with your code?  Nothing!  This sucks.  Code is rarely owned by one person.  Many people need to work on it and understand it and forcing your view of how it should look on everyone can make that a more difficult task.


The solution?  Well, we could try to merge the best of both worlds.  Use tabs for indentation and spaces just for alignment.  That would give us the third camp:

 class MyPen
{
<tab   >public void Method1(int i, 
<tab   >....................string s)
}

Then someone who likes small indents would see:

 class MyPen
{
<>public void Method1(int i, 
<>....................string s)
}

This is certainly the least wrong of the three camps.  It allows for alignment to not be destroyed, while giving flexibility to anyone who views it to see indentation the way they want it.  Many would argue that that is the best we can do.  tabs are meant for indentation and spaces are meant for alignment, so as long as you use them that way then you're doing the best you can.
I disagree with that sentiment.

The real issue here is that in most programming languages (i'll leave out Python and Whitespace since they've mostly eliminated this issue) is that whitespace is pretty irrelevant.  The difference between a clump of whitespace and one single whitespace is almost never relevant, and the difference between any whitespace and no whitespace if often not relevant.  Because of that, many people have fun with whitespace and cross the zero/one/infinity boundaries in order to make their code look good to them. 

For example, i find the following mostly unreadable:

 class MyPen
{
<>public void Method1(int i, int j,
<>....................string s)
}

I can only really deal with all parameters on one line, or each parameter on a different line.  However, if we only pay attention to tabs and spaces then when i open this document I will still find it illegible. 


So I'm of the 4th camp:
Whitespace might be part of the actual 'data,' but when I'm dealing with editing it present it in a 'view' that looks right to me by passing it through the formatting 'model' that knows how I like things to work.  When I save, some set of group rules will decide the form it is saved in.  So when i look at that method above I see all the parameters on different lines, when you look at it you see it you'll see all the parameters on the same line, and when that freaky girl over there looks at it she'll see it written as above.  

This need not affect any tools or experience of yours.  Say you're debugging; the debugger will know the actual location in the code where your current statement is, it then passes that span to the view which automatically remaps that span to the view I currently have in front of me.  It's a totally transparent operation to every tool currently out there because it's just a layer that sits between me and the current final view layer. 

Can we do this for the next version?   Can we unify the concepts of "team settings" and "user settings" so that you the developer can work with code in the best way for you while not impacting your peers from developing in the best way for them?  I don't think we can for everything, but i think we certainly can in this area :-)