<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Tabs vs. spaces</title>
	<atom:link href="http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces/feed" rel="self" type="application/rss+xml" />
	<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces</link>
	<description>The personal weblog of Peter Hosey.</description>
	<pubDate>Fri, 05 Dec 2008 13:13:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136709</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Thu, 08 Nov 2007 04:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136709</guid>
		<description>&lt;blockquote&gt;&lt;p&gt;Not only would I dislike having to consider what sort of horizontal space to insert this time, I don't want to have to hit the space bar umpteen times for correct alignment—not when my text editor is quite good about managing this with the tab key.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Copy-and-paste. ☺&lt;/p&gt;

&lt;p&gt;For indentation, all good editors offer auto-indentation. One keypress and it's indented correctly.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;I'll keep using spaces. It's simpler for me, never seems to cause trouble, and is presently the accepted thing to do. (Besides, the thought of someone viewing my code with an eight-space indent? It's enough to make me cringe!)&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Why do you care?&lt;/p&gt;</description>
		<content:encoded><![CDATA[<blockquote cite="http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-"><p>Not only would I dislike having to consider what sort of horizontal space to insert this time, I don't want to have to hit the space bar umpteen times for correct alignment—not when my text editor is quite good about managing this with the tab key.</p>
</blockquote>
<p>Copy-and-paste. ☺</p>
<p>For indentation, all good editors offer auto-indentation. One keypress and it's indented correctly.</p>
<blockquote cite="http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-"><p>I'll keep using spaces. It's simpler for me, never seems to cause trouble, and is presently the accepted thing to do. (Besides, the thought of someone viewing my code with an eight-space indent? It's enough to make me cringe!)</p>
</blockquote>
<p>Why do you care?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136708</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Thu, 08 Nov 2007 04:25:04 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136708</guid>
		<description>zachrahan: Wow, you're right. Thanks for pointing that out.

That comment syntax is pretty, and I would love a programming language or an editor with inherent support for that. I can't say I can recommend it with modern tools, however, mostly because of the issue mind and you raise.</description>
		<content:encoded><![CDATA[<p>zachrahan: Wow, you're right. Thanks for pointing that out.</p>
<p>That comment syntax is pretty, and I would love a programming language or an editor with inherent support for that. I can't say I can recommend it with modern tools, however, mostly because of the issue mind and you raise.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Cunningham</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136707</link>
		<dc:creator>James Cunningham</dc:creator>
		<pubDate>Thu, 08 Nov 2007 04:20:42 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136707</guid>
		<description>&#62; I said this in the post: Use spaces for columns. Only use tabs for indents.

Isn't that something of a pain in the rear, though? I use the tab key to insert a large amount of horizontal space. Sometimes I'm indenting; sometimes I'm lining up columns. Not only would I dislike having to consider what sort of horizontal space to insert &lt;i&gt;this&lt;/i&gt; time, I don't want to have to hit the space bar umpteen times for correct alignment—not when my text editor is quite good about managing this with the tab key.

I'll keep using spaces. It's simpler for me, never seems to cause trouble, and is presently the accepted thing to do. (Besides, the thought of someone viewing my code with an eight-space indent? It's enough to make me cringe!)</description>
		<content:encoded><![CDATA[<p>&gt; I said this in the post: Use spaces for columns. Only use tabs for indents.</p>
<p>Isn't that something of a pain in the rear, though? I use the tab key to insert a large amount of horizontal space. Sometimes I'm indenting; sometimes I'm lining up columns. Not only would I dislike having to consider what sort of horizontal space to insert <i>this</i> time, I don't want to have to hit the space bar umpteen times for correct alignment—not when my text editor is quite good about managing this with the tab key.</p>
<p>I'll keep using spaces. It's simpler for me, never seems to cause trouble, and is presently the accepted thing to do. (Besides, the thought of someone viewing my code with an eight-space indent? It's enough to make me cringe!)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zachrahan</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136706</link>
		<dc:creator>zachrahan</dc:creator>
		<pubDate>Thu, 08 Nov 2007 04:09:54 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136706</guid>
		<description>Peter, I agree with you entirely, but mind has a valid point. With your "tabs for indenting scopes, spaces for alignment" rule, there is no way to ensure that comments on lines with different tab-indents align properly. Go back and look at mind's example, and format it with tabs for the indents, and spaces to make the comments line up. Then change the tab width, and the comments no longer line up.

I think this is a minor issue compared to the utility of tabs otherwise, but it is an bona fide issue.</description>
		<content:encoded><![CDATA[<p>Peter, I agree with you entirely, but mind has a valid point. With your "tabs for indenting scopes, spaces for alignment" rule, there is no way to ensure that comments on lines with different tab-indents align properly. Go back and look at mind's example, and format it with tabs for the indents, and spaces to make the comments line up. Then change the tab width, and the comments no longer line up.</p>
<p>I think this is a minor issue compared to the utility of tabs otherwise, but it is an bona fide issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136688</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Thu, 08 Nov 2007 03:20:45 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136688</guid>
		<description>&lt;p&gt;mind:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;if you use tabs to make the column for the comments, then that will fail for various tab sizes and line lengths.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That's why you shouldn't use tabs to make columns. I said this in the post: Use spaces for columns. Only use tabs for indents.&lt;/p&gt;

</description>
		<content:encoded><![CDATA[<p>mind:</p>
<blockquote cite="http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-"><p>if you use tabs to make the column for the comments, then that will fail for various tab sizes and line lengths.</p>
</blockquote>
<p>That's why you shouldn't use tabs to make columns. I said this in the post: Use spaces for columns. Only use tabs for indents.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mind</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136649</link>
		<dc:creator>mind</dc:creator>
		<pubDate>Thu, 08 Nov 2007 02:49:07 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136649</guid>
		<description>well uh, apparently my comment didn't format the same way the preview did, even though i put it in a pre block. but think about standard python indentation with inline comments that line up</description>
		<content:encoded><![CDATA[<p>well uh, apparently my comment didn't format the same way the preview did, even though i put it in a pre block. but think about standard python indentation with inline comments that line up</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mind</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136647</link>
		<dc:creator>mind</dc:creator>
		<pubDate>Thu, 08 Nov 2007 02:47:28 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136647</guid>
		<description>The problem with tabs arises when you want to create columns on lines that aren't indented the same amount. Under your rules..

&lt;pre&gt;if foo:         # some inline, but
        bar()   # multi-line comment&lt;/pre&gt;

(with a tab to indent the second line) will only look correct if tab stops are set to 8. if you use tabs to make the column for the comments, then that will fail for various tab sizes and line lengths.

so, now you've got the worst of both worlds. tab stops must be set to the size that the file was edited with in order to look correct, and you've got to set that size. simply putting spaces in makes it so that people can't adjust the indentation to suit them, but that there is no ambiguity with further columns.

further, if someone does edit your file and uses spaces for indentation, then your columns again break when the tab stop is changed. you're better off adopting a concrete layout in the file, and any people who edit it need to follow a certain style. tabs don't solve all of the problems, therefore they just add complexity.</description>
		<content:encoded><![CDATA[<p>The problem with tabs arises when you want to create columns on lines that aren't indented the same amount. Under your rules..</p>
<pre>if foo:         # some inline, but
        bar()   # multi-line comment</pre>
<p>(with a tab to indent the second line) will only look correct if tab stops are set to 8. if you use tabs to make the column for the comments, then that will fail for various tab sizes and line lengths.</p>
<p>so, now you've got the worst of both worlds. tab stops must be set to the size that the file was edited with in order to look correct, and you've got to set that size. simply putting spaces in makes it so that people can't adjust the indentation to suit them, but that there is no ambiguity with further columns.</p>
<p>further, if someone does edit your file and uses spaces for indentation, then your columns again break when the tab stop is changed. you're better off adopting a concrete layout in the file, and any people who edit it need to follow a certain style. tabs don't solve all of the problems, therefore they just add complexity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136635</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Thu, 08 Nov 2007 01:49:44 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-136635</guid>
		<description>I'm pretty sure the only way we're ever going to solve this is to wait until emacs acquires time traveling capabilities, then go back in time and stop emacs from being created.</description>
		<content:encoded><![CDATA[<p>I'm pretty sure the only way we're ever going to solve this is to wait until emacs acquires time traveling capabilities, then go back in time and stop emacs from being created.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-42363</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Wed, 09 May 2007 02:59:51 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-42363</guid>
		<description>Mike: Absolutely—we should all use spaces to align columns. That's different from indenting a line, which should be done with a tab.</description>
		<content:encoded><![CDATA[<p>Mike: Absolutely—we should all use spaces to align columns. That's different from indenting a line, which should be done with a tab.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-42164</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 08 May 2007 23:27:26 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-42164</guid>
		<description>Tabs are great except for when they need to define a set number of characters. Michael Dippery pointed out one example of this. The other is if you line up values in large variable blocks or define statements.

Things like this:

#define this            8
#define longerthis  5

If someone has a longer tab stop when they format the code, the values may not line up for users of smaller tab stops.</description>
		<content:encoded><![CDATA[<p>Tabs are great except for when they need to define a set number of characters. Michael Dippery pointed out one example of this. The other is if you line up values in large variable blocks or define statements.</p>
<p>Things like this:</p>
<p>#define this            8<br />
#define longerthis  5</p>
<p>If someone has a longer tab stop when they format the code, the values may not line up for users of smaller tab stops.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-41468</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Tue, 08 May 2007 11:14:22 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-41468</guid>
		<description>Thanks for the interesting post. As you correctly point out, using tabs for ``indentation'' necessitates the use of spaces for ``alignment.'' Here's the problem: People invariably screw this up. Yes, as simple as it sounds to you and me, there are tons of programmers out there &lt;em&gt; who will never get it&lt;/em&gt;. They can't wrap their heads around the difference between indentation and alignment, no matter how many times you explain it. Their code is a haphazard mess of tabs and spaces, and they don't even know they're doing it.

Now, let's say you work on a project with 500 other programmers. Do you have time to track down each offender and give them an earful for using tabs and spaces inappropriately? Even if you did, it wouldn't matter---they'll just do it again. While it may be technically superior to argue ``tabs-for-indentation-and-spaces-for-alignment,'' it doesn't scale in practice.

The only way to stop the insanity is to tell everyone to use all spaces &lt;em&gt;all the time&lt;/em&gt;. This is simpler to grasp &lt;em&gt;conceptually&lt;/em&gt;. Even the dumbest programmer can understand what ``all-spaces'' means, sort of. They'll probably still leave trailing whitespace all over and maybe the occasional tab, but the result is still much cleaner than an inconsistent mix of tabs and spaces.</description>
		<content:encoded><![CDATA[<p>Thanks for the interesting post. As you correctly point out, using tabs for ``indentation'' necessitates the use of spaces for ``alignment.'' Here's the problem: People invariably screw this up. Yes, as simple as it sounds to you and me, there are tons of programmers out there <em> who will never get it</em>. They can't wrap their heads around the difference between indentation and alignment, no matter how many times you explain it. Their code is a haphazard mess of tabs and spaces, and they don't even know they're doing it.</p>
<p>Now, let's say you work on a project with 500 other programmers. Do you have time to track down each offender and give them an earful for using tabs and spaces inappropriately? Even if you did, it wouldn't matter---they'll just do it again. While it may be technically superior to argue ``tabs-for-indentation-and-spaces-for-alignment,'' it doesn't scale in practice.</p>
<p>The only way to stop the insanity is to tell everyone to use all spaces <em>all the time</em>. This is simpler to grasp <em>conceptually</em>. Even the dumbest programmer can understand what ``all-spaces'' means, sort of. They'll probably still leave trailing whitespace all over and maybe the occasional tab, but the result is still much cleaner than an inconsistent mix of tabs and spaces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Smith</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-40791</link>
		<dc:creator>David Smith</dc:creator>
		<pubDate>Tue, 08 May 2007 01:46:11 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-40791</guid>
		<description>Is there anywhere we can file a bug report on emacs about this odd behavior it has? I'd love to see the myth of spaces-for-indenting-makes-sense die a well deserved death.</description>
		<content:encoded><![CDATA[<p>Is there anywhere we can file a bug report on emacs about this odd behavior it has? I'd love to see the myth of spaces-for-indenting-makes-sense die a well deserved death.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rolf Howarth</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-40686</link>
		<dc:creator>Rolf Howarth</dc:creator>
		<pubDate>Mon, 07 May 2007 23:39:05 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-40686</guid>
		<description>The solution to the problem of misaligned code that contains tabs and spaces is not to eliminate tabs, nor is to try to standardise on how wide a tab should be rendered, but to NEVER, EVER, EVER under ANY CIRCUMSTANCES use SPACES for indentation.

Using tabs preserves the semantic structure (ie. indent level) whereas spaces are just a lazy way of getting something that maybe looks roughly right at the time. It's &lt;i&gt;exactly&lt;/i&gt; the same as when people screw up MS Word or HTML documents by including low level character formatting rather than defining styles. I hope no one is going to argue that because a mixture of styles and low level formatting is bad the answer is to put in abominations like &#60;b&#62;&#60;font size=+1&#62; everywhere instead of writing &#60;h1&#62; !</description>
		<content:encoded><![CDATA[<p>The solution to the problem of misaligned code that contains tabs and spaces is not to eliminate tabs, nor is to try to standardise on how wide a tab should be rendered, but to NEVER, EVER, EVER under ANY CIRCUMSTANCES use SPACES for indentation.</p>
<p>Using tabs preserves the semantic structure (ie. indent level) whereas spaces are just a lazy way of getting something that maybe looks roughly right at the time. It's <i>exactly</i> the same as when people screw up MS Word or HTML documents by including low level character formatting rather than defining styles. I hope no one is going to argue that because a mixture of styles and low level formatting is bad the answer is to put in abominations like &lt;b&gt;&lt;font size=+1&gt; everywhere instead of writing &lt;h1&gt; !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hosey</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-40538</link>
		<dc:creator>Peter Hosey</dc:creator>
		<pubDate>Mon, 07 May 2007 20:16:20 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-40538</guid>
		<description>Michael Dippery: Yes, it applies to C too, despite the absence of colons: Xcode should use tabs until it matches the indentation of the start of the statement, and then continue with spaces.</description>
		<content:encoded><![CDATA[<p>Michael Dippery: Yes, it applies to C too, despite the absence of colons: Xcode should use tabs until it matches the indentation of the start of the statement, and then continue with spaces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Dippery</title>
		<link>http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-40474</link>
		<dc:creator>Michael Dippery</dc:creator>
		<pubDate>Mon, 07 May 2007 18:41:33 +0000</pubDate>
		<guid isPermaLink="false">http://boredzo.org/blog/archives/2007-05-07/tabs-vs-spaces#comment-40474</guid>
		<description>What about in the case of function arguments that wrap, such as this:

&lt;pre&gt;int x = MyFunction(int a,
                   int b,
                   int c)&lt;/pre&gt;

(I don't know if that will turn out to be formatted okay, but you probably get the gist -- the "ints" in the parameter list should all be lined up).

In this case, it seems spaces &lt;em&gt;should&lt;/em&gt; be used, otherwise the ints won't line up; i.e., if I set my tab width to 8 and line them up with tabs (and an extra space or two or three, if necessary), it won't look right to &lt;em&gt;you&lt;/em&gt; if your tab width is only 4.

So is that to say that it's best to use tabs &lt;em&gt;except&lt;/em&gt; in cases of aligning parameter lists (or, in the case of Objective-C, aligning parameter names according to colons)?</description>
		<content:encoded><![CDATA[<p>What about in the case of function arguments that wrap, such as this:</p>
<pre>int x = MyFunction(int a,
                   int b,
                   int c)</pre>
<p>(I don't know if that will turn out to be formatted okay, but you probably get the gist -- the "ints" in the parameter list should all be lined up).</p>
<p>In this case, it seems spaces <em>should</em> be used, otherwise the ints won't line up; i.e., if I set my tab width to 8 and line them up with tabs (and an extra space or two or three, if necessary), it won't look right to <em>you</em> if your tab width is only 4.</p>
<p>So is that to say that it's best to use tabs <em>except</em> in cases of aligning parameter lists (or, in the case of Objective-C, aligning parameter names according to colons)?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.265 seconds -->
