Tabs "can be displayed completely differently on different types of systems and editors"?

While reading the arguments against using tabs, I came across this ( source ):

... it might be a good idea to avoid tabs alltogether, because the semantics of tabs are not very well defined in the computer world, and they can be displayed very differently for different types of systems and editors .

I am relatively new to programming and have never experienced tabbed issues in my code, and I have used a number of editors, including Notepad ++, Programmer Nodepad, Gedit, Kate, Sublime Text, etc. Perhaps I haven’t done enough coding to get to this point, so the question is:

Can someone explain, simply in words, what the quote means? And is the tab issue still relevant?


Please note that I am not asking you if I should use tabs or spaces in my code. I only after a rational explanation of the specific argument against the tabs that I met.

+4
source share
2 answers

I assume that you want to see some examples, so I have listed some of the most common.

Problem number 1: tab width is not consistent

This for is displayed in completely different ways on different types of systems and editors .

( ) : " , N", N .

"" N 8, 4 2, " ".

.

2 8 , , .

, - : 2 . :

class Foo:
  def doSomething(a):
    if test(a):
      // some nice comment
      // about this
      bar(a)

- , 8. :

class Foo:
        def doSomething(a):
                if test(a):
                        // some nice comment
                        // about this
                        bar(a)

- .

Align

. , . , .

2:

class Foo:
  def do_something(a):
    if test(a):
      foo     = a.foo     // some nice comment
      foo_bar = bar(foo)  // about this
      bar(a)

- , 8. , <pre>. "" 8, :

class Foo:
        def do_something(a):
                if test(a):
                        foo                     = a.foo                 // some nice comment
                        foo_bar = bar(foo)      // about this
                        bar(a)

. .

.

80.

-, 2, , . - 74 ( , 72).

class Foo:
  def do_something(a):
    // Some very nice comment about code bellow using more then few words.

- , 8 (, ), , , 86:

class Foo:
        def do_something(a):
                // Some very nice comment about code bellow using more then few words.

, .

№2:

" .

, " , N".

- . , " ", (, , ).

, , - , :

Document with tab stops

, . , :

Code in document with arbitrary tab stops

. .

, .

.

+7

@Giedrius answer (+1), , .

? , .

? , , . , . ( M); (compare i and M). ? , , , . ( , Guttenberg , , , , , , .)

, , -, .

(, , - ?) , . , ( , , , Steampunk), , .

- , - , -, , , . ( ? , waaay , . < < Insert Liquid Paper reference here. → ) , - TAB. X , , ", ", , , . ? , , . ( "X" .)

: , - . "" , .

+1

All Articles