June 03, 2011
On 4/11/2011 1:31 PM, Nick Sabalausky wrote:
> In other words, *some* editors handle space-indentation intelligently (and
> do so by reinventing *tabs*), while *all* editors handle tab-indentation
> intelligently.

There is no way to handle tabs intelligently.

Take a source file that has tab characters in it. There is no algorithm in the world that will discern what the tab size is supposed to be. Heck, I've seen plenty of source files that assume a tab size of X in some sections and Y in others, and Z in still others.

The only way to win is to not use tabs.

June 03, 2011
8 space tabs are the One True Way. All other tabstops are evil.
June 03, 2011
Am 03.06.2011 20:54, schrieb Walter Bright:
> On 4/11/2011 1:31 PM, Nick Sabalausky wrote:
>> In other words, *some* editors handle space-indentation intelligently
>> (and
>> do so by reinventing *tabs*), while *all* editors handle tab-indentation
>> intelligently.
> 
> There is no way to handle tabs intelligently.
> 
> Take a source file that has tab characters in it. There is no algorithm in the world that will discern what the tab size is supposed to be. Heck, I've seen plenty of source files that assume a tab size of X in some sections and Y in others, and Z in still others.
> 
> The only way to win is to not use tabs.
> 

If you use tabs for indentation and spaces for alignment the tabsize doesn't matter.
June 03, 2011
Daniel Gibson wrote:
> Am 03.06.2011 20:54, schrieb Walter Bright:
>> On 4/11/2011 1:31 PM, Nick Sabalausky wrote:
>>> In other words, *some* editors handle space-indentation intelligently
>>> (and
>>> do so by reinventing *tabs*), while *all* editors handle tab-indentation
>>> intelligently.
>>
>> There is no way to handle tabs intelligently.
>>
>> Take a source file that has tab characters in it. There is no algorithm in the world that will discern what the tab size is supposed to be. Heck, I've seen plenty of source files that assume a tab size of X in some sections and Y in others, and Z in still others.
>>
>> The only way to win is to not use tabs.
>>
>
> If you use tabs for indentation and spaces for alignment the tabsize doesn't matter.

http://www.emacswiki.org/emacs/SmartTabs

In a perfect world, everyone would do that. But if multiple people are working on the same source, one of them will mess up the formatting...

June 03, 2011
On Fri, Jun 3, 2011 at 3:04 PM, Daniel Gibson <metalcaedes@gmail.com> wrote:

> Am 03.06.2011 20:54, schrieb Walter Bright:
> > On 4/11/2011 1:31 PM, Nick Sabalausky wrote:
> >> In other words, *some* editors handle space-indentation intelligently
> >> (and
> >> do so by reinventing *tabs*), while *all* editors handle tab-indentation
> >> intelligently.
> >
> > There is no way to handle tabs intelligently.
> >
> > Take a source file that has tab characters in it. There is no algorithm in the world that will discern what the tab size is supposed to be. Heck, I've seen plenty of source files that assume a tab size of X in some sections and Y in others, and Z in still others.
> >
> > The only way to win is to not use tabs.
> >
>
> If you use tabs for indentation and spaces for alignment the tabsize doesn't matter.
>

This is my preferred approach, too.

Adam


June 04, 2011
On 03/06/2011 19:06, Jonathan M Davis wrote:
<snip>
> That sort of talk leads to things like this: http://xkcd.com/378/

I was told that Real Programmers use punch cards.  Someone must've found some even realer programmers....

Stewart.
June 04, 2011
On 03/06/2011 20:15, Timon Gehr wrote:
> Daniel Gibson wrote:
<snip>
>> If you use tabs for indentation and spaces for alignment the tabsize
>> doesn't matter.
>
> http://www.emacswiki.org/emacs/SmartTabs

Taken the words out of my mouth there.  I've been faced with files that are a mishmash of tabs and spaces, and been tidying them up to this style.

The problem is that some editors will, when you indent a block of code, change the alignment spaces back into tabs.  Though I do find that feature useful as a first step in cleaning up sources that are in a total mess in terms of tab/space indentation.  At work we use Visual Studio, but when I find that a source file needs tidying I would open it in Notepad++ as it behaves in this way.  I also tend to use its Trim Trailing Space feature quite often....

Stewart.
June 04, 2011
On 6/3/2011 5:14 PM, Stewart Gordon wrote:
> On 03/06/2011 20:15, Timon Gehr wrote:
>> Daniel Gibson wrote:
> <snip>
>>> If you use tabs for indentation and spaces for alignment the tabsize
>>> doesn't matter.
>>
>> http://www.emacswiki.org/emacs/SmartTabs
>
> Taken the words out of my mouth there. I've been faced with files that are a
> mishmash of tabs and spaces, and been tidying them up to this style.

Good luck making that work.
June 04, 2011
On 06/03/2011 02:48 PM, Walter Bright wrote:
>
> In the beginning, God created tabs. Tab stops were 8 spaces

It's 2011. The idea that some character means 8 spaces and should be used to layout code is ass-backwards, regardless if everybody actually followed that rule. It was a fine rule for 1960.
Next ›   Last »
3 4 5 6 7 8 9 10 11 12 13
Top | Discussion index | About this forum | D home