Welcome to the Chaos
April 25, 2024

Whose Space Is It Anyways? The Battle of Indents and Whitespace In Code

Whose Space Is It Anyways? The Battle of Indents and Whitespace In Code

The contentious debate about tabs vs. spaces in coding, breaking down its historical roots and current implications.

Tabs vs. spaces 

This Chaos Lever episode explores the surprisingly intense debate around using tabs and spaces in programming. Ned and Chris cover the historical journey of coding practices from punch cards to modern coding environments. They discuss how seemingly small choices, like whether to use tabs or spaces, have great implications for code readability, maintenance, and even programmers’ salaries.


Links: 

Transcript

00:00:00
Ned: Your camera’s freezing occasionally.


00:00:02
Chris: No, it’s not.


00:00:04
Ned: And there it goes.


00:00:05
Chris: No, it didn’t. It’s fine. Looks fine to me.


00:00:08
Ned: And your mic’s a little hot too. Everything is wrong. Hello, alleged human, and welcome to the Chaos Lever podcast. My name is Ned, and I’m definitely not a robot. I am a real human person with eyes that see, hair that grows, and an internal fusion-based power source that will outlast this feeble planet. Just like all humans. With me is Chris, who is also here. Hi, Chris.


00:00:41
Chris: Ah, the heat death of the universe can’t come fast enough [sigh].


00:00:44
Ned: It is coming for all of us. I didn’t really understand the heat death of the universe for a long time—probably still don’t—but something about entropy and how everything just balances out, and we’ll be in just a cold… even goo, I guess?


00:00:59
Chris: No, the heat death of the universe requires the big bang, A, to have happened—which is still contentious, sort of—but, B, the expansion of the universe to continue forever.


00:01:11
Ned: Yes.


00:01:12
Chris: Now, there’s also a lot of argument as to whether that’s going to happen. But it’s 14 trillion years from now, so it probably doesn’t matter to us.


00:01:19
Ned: Says you [laugh].


00:01:21
Chris: Aw crap.


00:01:23
Ned: I’ve got so much helium stockpiled, I’m going to be good.


00:01:27
Chris: You and the US government.


00:01:29
Ned: Well, those blimps aren’t going to run on hopes and dreams, Chris.


00:01:33
Chris: Did you know that? Did you know that the US has an emergency stockpile of helium?


00:01:39
Ned: No. Is that in case they want to have a really big party?


00:01:43
Chris: Let’s go with yes.


00:01:44
Ned: [laugh]. Define party. I don’t think it means what you think it means. Yeah, I’m not shocked. I didn’t know that. I wonder what other elements they have of that, like, massive stockpiles of it. If they’re just like, “Man, we need a lot of cobalt, for reasons.”


00:02:02
Chris: Well, it’s either that or Elon Musk misuses it in Cybertrucks or some stupid thing.


00:02:09
Ned: Ugh, Cybertrucks. You know, people have already listened to the tech news articles at this point, so I’m not spoiling anything to say that we are going to be discussing how people review products, and one product that has been reviewed very poorly has been the Cybertruck.


00:02:25
Chris: And I saw one in person today. First time.


00:02:30
Ned: Do you feel special?


00:02:32
Chris: I feel like a little piece of my soul has just been taken away.


00:02:35
Ned: Torn out by the sharp edges of the Cybertruck?


00:02:38
Chris: Dude, it looks terrible.


00:02:40
Ned: [laugh].


00:02:41
Chris: Now, admittedly, I saw it from a bit of a distance. I would say it was 40, 50 yards up a driveway—


00:02:48
Ned: Okay.


00:02:48
Chris: —and it’s crappy weather. So, it’s not ideal observing of a vehicle that is gray because it’s just going to look even nastier, grayer, and uglier.


00:02:58
Ned: Yeah.


00:02:58
Chris: But like, have you ever seen a DeLorean in person?


00:03:01
Ned: Yes, I have.


00:03:02
Chris: The stainless steel looks sharp, even though the car doesn’t—you know, stylistically did not age well from the ’80s, the body still looks sharp.


00:03:10
Ned: Yeah. In the late-’80s, a neighbor around the corner actually had a DeLorean, and so we would walk past it, on a regular basis because Back to the Future and all that.


00:03:21
Chris: Yeah. Yeah, you find excuses to walk past a DeLorean. I understand completely [laugh].


00:03:25
Ned: Okay [laugh].


00:03:27
Chris: But no, the Cybertruck just looks cheap. It looks like… you know, you remember when you used to make race cars that you carved them out of wood? I think this was for the Boy Scouts?


00:03:37
Ned: Yeah. Yeah. It wasn’t the Pine Box Derby. It was called the Pine Block Derby or something like that?


00:03:41
Chris: Yeah, something like that. But you would always end up with a super blocky thing. Imagine one of those covered with aluminum foil. That is what the Cybertruck looks like in person.


00:03:51
Ned: I think aluminum foil is too shiny, but [laugh] point taken. Oh, God, I participated in those Pine Block Derbies, and did not do well because my father did not assist. And even if he had, he’s not particularly handy with tools—not to say that I am—and so whatever would have come out of our joint collaboration would have been an aberration. You can tell which kids had parents that were wood smiths of some kind or another.


00:04:25
Chris: Yeah. Yeah, you could tell because they’re the ones that win.


00:04:28
Ned: Yes. With these immaculately styled and painted cars. It’s like yeah, your eight-year-old did not make that.


00:04:36
Chris: Right. Just like the Girl Scouts who sell $75,000 worth of cookies. Yeah, okay. She did that door-to-door. Okay.


00:04:43
Ned: Yeah. That’s called blackmail, Chris. Somebody’s got some deets on some other people [laugh]. Oh, I got my blackmail badge. It’s got an envelope on it. Isn’t that nice?


00:04:57
Chris: Should just call it a nepotism badge“. Mommy sold lots of cookies this year. Everyone at the school has diabetes.”


00:05:04
Ned: Oh well, sell them sugar-free ones. It’s fine.


00:05:06
Chris: N—wha—have some respect for yourself and others, sir.


00:05:09
Ned: Clearly, I don’t have either. What were we talking about?


00:05:12
Chris: I have no idea.


00:05:14
Ned: Excellent.


00:05:15
Chris: Moving on?


00:05:16
Ned: Moving on.


00:05:17
Chris: Instead of rambling about whatever the hell it is we’re rambling about now, let’s ramble somewhat more [coherently 00:05:22] about the spacing wars in computer files.


00:05:28
Ned: This is not the same as, like, the Space War/Star Wars program from the ’80s where we’re going to use lasers to destroy missiles, right?


00:05:36
Chris: No, this is how you put whitespace into files.


00:05:40
Ned: Almost as contentious.


00:05:42
Chris: Subtitle, “Tabs vs. Spaces: The never-ending battle beyond code.”


00:05:48
Ned: Part six?


00:05:50
Chris: That is the title of a Medium article that sums up everything I’m going to talk about for the next X amount of minutes. Now, I cannot give you the overall position taken by the author of said article, as it was a Medium members-only posting, and as we discussed a few weeks ago, I don’t pay for Medium. I know, I know, what a hero I am, today and every day. Dot com.


00:06:14
Ned: Well done, sir.


00:06:16
Chris: Anyway, the question at hand to outsiders seems silly: tabs or spaces? The reason for that—why it seems silly—is because it is silly. There is a demonstrable right answer, and the answer has never changed [laugh].


00:06:33
Ned: Oh, boy [laugh]. And our friendship is over.


00:06:38
Chris: [laugh]. Rephrasing the question does not help resolve the silliness. All we’re asking here is how should your code, or your configuration files, or what have you, how should it look? How do you make a line start further from the beginning of the line? Do you hit the spacebar a bunch of times or do you hit the tab key once? Either way, if you’re intending on readability—or in the case of some things such as YAML for its syntactical requirements, which I will have opinions about later—is it better to use the spacebar a bunch of times—tap, tap, tap, tap, tap, or one tab, taaaap. That’s right: it’s a sad tap when you hit tab.


00:07:19
Ned: [laugh] It makes that sound? Taaaap.


00:07:21
Chris: Taaaap. Now, if you’re not a computer person of a certain touchiness or absolutist state of mind, your answer to this question is, this is the stupidest idea for a podcast episode ever. Who could possibly care about this question? What in the Wide World of Sports is going on here?


00:07:40
Ned: [laugh] oh, those are the same people that are going to argue about slight changes in the rules for the next season of baseball.


00:07:48
Chris: The Manford Runner is bullshit. But then again, so is the DH. Fight me in real life.


00:07:55
Ned: [laugh] I don’t know what any of that means.


00:07:56
Chris: [laugh] In order to clarify how much of a fiasco this computer problem is—we’ll talk about Manford later—allow me to enlighten you with this fact: if you google search “Tabs versus spaces”—as of the time I wrote this April 17th, 2024, way too late at night, “Tabs versus spaces” Google search returned 284 million results.


00:08:23
Ned: That’s too many.


00:08:24
Chris: People have opinions. It’s what I’m saying.


00:08:28
Ned: Indeed.


00:08:29
Chris: So, in order to set the stage for why this situation even exists, we have to do the usual thing, which is to go back to the beginning where it all started, once upon a time. And when we talk about things like that in the computer world, we’re talking about FORTRAN.


00:08:47
Ned: Whoo.


00:08:48
Chris: Actually, it starts before FORTRAN.


00:08:51
Ned: Oh.


00:08:52
Chris: Beforetran, some might say?


00:08:54
Ned: I’ll allow it.


00:08:56
Chris: [laugh]. Yeah, I can tell you haven’t had enough coffee.


00:08:58
Ned: Mmm.


00:08:59
Chris: This particular situation begins with punch cards. Now, I am sure that even non-computer people know that the original way to give computers information was to create punch cards—


00:09:11
Ned: Well—


00:09:11
Chris: —basically a giant Scantron.


00:09:14
Ned: —how pedantic do you want me to be?


00:09:15
Chris: I want you to be quiet and listen.


00:09:17
Ned: Fair.


00:09:18
Chris: Punch cards were very rigidly defined and physical—therefore non-editable—input squares on a number of 7.375 by 3.25 inch cards. Why so obnoxiously specific? IBM. Any more questions? No, I didn’t think so. Now, you have a punch card—which is bigger than an index card, but it’s the same idea—there’s a lot of space. It is clearly defined into columns. There are 80 columns and there are 12 rows. The columns identified what you were going to do with the information. The first column identified if it was a comment, aka don’t process what comes next.


00:10:03
Ned: Got you.


00:10:03
Chris: Then there were some labels for the next five. Think line numbers in BASIC. Sometimes you can have actions like goto. Then from 6 to 73 is where the actual code goes. And then from 74 to 80, an optional sequence—doesn’t necessarily have to be there. Usually it’s blank. One line of code was one card. Okay? The cards had 12 rows, so you could do a combination of punches and non-punches to add up to a letter. So, you can’t just put ‘A’ on a punch card. All you have is 12 dots that you can either punch in or leave unpunched. So, just like Morse code, like, dot is A, dot-dot is B, different code was used to create a punch card, a letter that made sense. You just had a lot more room. It was called the Hollerith code. And we don’t have to go into exactly how it works, but the point is, you had this very rigidly defined system, you had all these columns that had very specific uses that was not up for debate. If the card did not have them set up correctly, the card was invalid, and you had to start over.


00:11:19
Ned: Yay.


00:11:20
Chris: Now, when you wrote for these computers on the punch cards, what you would do is type it in some type of code into a keypunch machine. The keypunch machine does that human-to-machine translation, runs out the card, you put the card on the pile, you hope to high heaven nobody knocks over your pile, and you move on to the next card. That was how you programmed mainframes for a while.


00:11:46
Ned: I got to imagine that would take… a certain amount of time.


00:11:50
Chris: Yeah. And precision.


00:11:53
Ned: Indeed.


00:11:54
Chris: Like, think about a typewriter, how stressful enough it was to do that before there was such a thing as erasable type.


00:12:03
Ned: [laugh]. Yes, if you type the line out wrong, you would have to get out your white-out and, you know, paint over the letter you typed wrong and then run it back and type it correctly. And that was rather time-consuming.


00:12:16
Chris: Right. Now, I still remember—just as a fun aside—my mother got one of those typewriters that had erasable type, and I thought it was a gift from God Himself. And why was I, a five-year-old, using a typewriter? Shut up, it was a weird household.


00:12:32
Ned: [laugh]. It’s you. No one’s surprised.


00:12:35
Chris: [laugh]. Anyway. So, this is what happened. And everybody got this code: these columns mean these things, this code goes here, it’s very rigid. No conversation, this is what has to happen. Eventually, though, we did move beyond punch cards. Punch cards left, but the concept remained and was insta—inshtatuted? Institut—[frustrated noises]. I don’t even know what I was doing with that sentence.


00:13:04
Ned: Let’s start over.


00:13:05
Chris: Okay. The punch cards left, but FORTRAN remained. The year was 1958. We had green screens now. They were very exciting. You could hit backspace to correct a mistake.


00:13:19
Ned: Whoa.


00:13:20
Chris: I know. It was a wild time. But FORTRAN was a product of its time. And by that I mean, formatting requirements that were shockingly similar to the ones that governed those IBM punch cards. Even though you had unlimited space and unlimited backspace, you had 80 characters. Your line was not going to be longer than that. Sorry, bud. Specific columns for specific needs? Absolutely. Now, the spacing has the same meaning. You didn’t use the Hollerith code anymore, but you still had to make everything line up correctly. And in order to make those columns still line up on the screen, you had to use spaces.


00:14:06
Ned: Right.


00:14:06
Chris: Now, admittedly, you also had to use capital letters because the original green screens didn’t have lowercase [laugh].


00:14:14
Ned: [laugh] Sure.


00:14:16
Chris: And also, as I said before, the line could only be 80 characters long because that’s what the framers intended.


00:14:24
Ned: Right.


00:14:25
Chris: Now, this actually didn’t matter at the time because FORTRAN was written with mainframes in mind, so you really couldn’t make a line that was longer than 80 characters anyway. But languages evolve, even FORTRAN. The language got more sophisticated, but those rigid formatting requirements stuck. How long did they stick, you might be asking me? All the way up to 1990—


00:14:49
Ned: Wow.


00:14:49
Chris: When FORTRAN’s update—the V90 update—finally made this rigidity of formatting optional. I probably don’t have to tell you that now, in 2024, there are still people who stick with the forced formatting, as God intended.


00:15:09
Ned: [laugh] I’m not shocked at all, especially if you came up through that programming ethos of using FORTRAN with this forced formatting. Even once the restrictions are lifted, you know, you’ve gotten into a habit. It’s become part of your tradition, and you don’t see any reason to deviate from that tradition, so that’s what you’re going to do. I get it.


00:15:33
Chris: Right. You know, and we could probably have a larger conversation about the pros and cons of having a language like FORTRAN that is so close to assembly versus a very, very abstracted one like Python, and the pros and cons of both, but that’s outside the context of this conversation. What did happen, though, is that FORTRAN was not the only programming language. Newer ones exist; existed at the time, in fact. Maybe, I don’t know, C, for example? Or like, all the other ones that you’ve ever heard of.


00:16:07
Ned: Haskell [laugh].


00:16:08
Chris: [laugh]. Funnily enough, I had to cut a big thing about Haskell.


00:16:12
Ned: Of course you did [laugh].


00:16:15
Chris: Keyboards also evolved. They got fun features like lowercase—


00:16:20
Ned: Whoa.


00:16:20
Chris: —and the tab key.


00:16:22
Ned: Mmm.


00:16:22
Chris: But the question remains, what does the tab key do? Here’s a fun fact. It depends.


00:16:29
Ned: Of course, it does.


00:16:31
Chris: Now, in old Unix standards, aka the before times, it was eight spaces, which is a lot. In many text editors these days, it’s four, which not a lot. In some IEDs—in some—in some IEDs [laugh].


00:16:49
Ned: [laugh].


00:16:49
Chris: That’s right. Tabs versus spaces now explodes. In some IDEs, you can configure it. So, here’s the thing. Just like when you’re reading a book, or an essay, or whatever, you actually want whitespace. It’s important. Whitespace separates words, sentences, paragraphs, makes things readable. Now, in the way before times, like, say old stuff in the Roman Empire that was sculpted into walls, you know what they didn’t do? Whitespace.


00:17:23
Ned: Yeah, why would you?


00:17:25
Chris: No breaks. When we started to create paper, no breaks. It’s insane that people can still read this stuff. Whitespace is super important for understanding, especially in the modern day, even though there are less words on a page, if you have a full line of space between paragraphs instead of just hitting enter to start a new line, you will read the text faster. That is a hundred percent true science.


00:17:50
Ned: So, what you’re saying is, if I—typically, especially older word processors, when you started a new paragraph, it just started a new line and maybe was indented by five spaces because I think that’s what you were supposed to do when you create a new paragraph. But what’s better is actually have a full, empty line between two paragraphs, and then I can read that text faster.


00:18:14
Chris: Yep. Absolutely. And the reason for that is that you don’t read the way that you think you read. Just a short aside, humans read in blocks of text. You don’t just read like, “Mary. Had. A. Little. Lamb.” You actually grab that entire sentence at one time and your brain processes it at once. If you have whitespace, you can grab the whole paragraph and process it at once. If you have a whole page of blocked text, you can’t do it.


00:18:41
Ned: No. Your brain just goes… “No.”


00:18:45
Chris: Yeah.


00:18:45
Ned: “Word soup. I’m out.”


00:18:47
Chris: Which is incidentally, why people used to use a pointer as a reading guide. So, you would follow the pointer to force your brain to read one word at a time instead of trying to grok the entire page. Something else you might have been taught when you were a kid is, take a blank piece of paper and hide everything else, and read one line at a time, and pull the paper line down.


00:19:08
Ned: Yep.


00:19:08
Chris: Same reason. So, whitespace matters. It’s super important for readability. And that’s one of the reasons that people get really uptight about how you create your code. So, there started to become these concepts of this is how you write—this is how you indent, especially—to understand what does this piece of code do? How is it related to the previous paragraph, to stick with that metaphor for just a second? And how did we do the separations? Hence, spaces out or tabs out. Because no languages that I talked about, with the exception of FORTRAN, required it. Now, there are languages like Python where you can do something called obfuscation where you do a semicolon—you don’t even have to hit enter—and you can create one line of code that is approximately 5 million characters long that is your program. That’s not readable.


00:19:59
Ned: No.


00:20:00
Chris: So, you’ve got away from the rigidity of FORTRAN into common usage. And this is where spaces versus tabs became a problem because some people thought it was better to hit tab one time; some people thought it was better to hit the spacebar X amount of times. Now, what do I think about all this? I’m glad you asked. The answer is spaces are absolutely better.


00:20:21
Ned: Oh. I was not expecting that.


00:20:24
Chris: This has been proven by many analyses that I choose to support because they totally line up with my already existing beliefs. And also—we’ll put this in the [show notes 00:20:33], of course—how can anyone question a website called Insane Lab?


00:20:39
Ned: [laugh]. All right.


00:20:39
Chris: Now, here are three points in favor, all of which are correct. First, and most importantly, it’s important to understand what’s happening under the covers. A tab and a space take up the exact same amount of computer space: it’s one character. Now, in Unicode, a tab is referenced as u+0009, and the space is represented as u+0020. See how they look almost exactly the same when they’re in the world of computerized—what do you—what do we even call this? In ASCII code, it would just be 9 and 20. The point is, it takes up one character space in your file. Because a tab is not a real thing. It’s a descriptor. It’s almost a meta character. It tells the interpreter, “Put X amount of space after this character of u+0009.” The problem with it is, “It says do X amount of spaces,” which is up to interpretation, as we talked about at the top.


00:21:45
Ned: Right.


00:21:46
Chris: A space is doing exactly one space. Not up for interpretation. It’s exactly the same character definition as, like, the letter Z. You hit the letter Z, and you get one single character of z. Same thing. Tab, not the same thing. Therefore, tabs are dumb.


00:22:06
Ned: I don’t know if I entirely agree with the last part, and my counterpoint to that is the way that word processors interpret a tab using tab stops. But I see your point when it comes to programming languages, and the way it gets displayed on the screen in an editor.


00:22:22
Chris: Right. And really, that’s what—I guess that’s an important distinction to make. We should talk about this explicitly in the areas of code, configuration files, et cetera.


00:22:32
Ned: There’s a number of control characters that have become ornery over time because they shouldn’t exist anymore. There’s the whole Carriage Return Line Feed, or CRLF—


00:22:43
Chris: Yes.


00:22:44
Ned: Which Windows by default, adds CRLF, and Linux, I believe just adds LF.


00:22:51
Chris: Correct. They’re better at it now, but if you move files from Windows to Linux, or back and forth, you have to be careful of that, or you get real weird things happening to your Word document.


00:23:00
Ned: If you don’t strip out that carriage return, and you move it over to a Linux file, mmm, just all kinds of things go wrong.


00:23:07
Chris: So.


00:23:08
Ned: Anyway.


00:23:09
Chris: Point number two, people who use spaces make more money.


00:23:13
Ned: What?


00:23:14
Chris: This is hilarious, but apparently true. An analysis of the data behind Stack Overflow’s 2017 developer survey—which was a big deal: 29,000 respondents—showed a clear gap in median salary. Now, this was all information that was volunteered, so take it for whatever grain of salt any type of self-selection does—


00:23:37
Ned: Fair.


00:23:38
Chris: But according to this analysis, people who use spaces made, like, 15 grand more, on average. It was a big difference.


00:23:47
Ned: Yeah.


00:23:49
Chris: Probably they were also taller, better looking, and more fun in general to be around. Unlike tab people, am I right? Like I said, totally scientific analysis. Now, one of the reasons for the above point is point number three, which is spaces are just used more. Period. In a similar supporting type of analysis, a Google engineer looked at the top 400,000 GitHubs in the first half of 2016—all of this is of course, public information, you can do this sort of thing, and back in 2016, it was fun—what he found was that spaces are wildly popular in almost every single language that allows them. The one where tabs outpaces spaces is, hilariously, C because remember, we’re talking about people with specifics, and obstinacy, therefore, C.


00:24:42
Ned: [laugh]. Fair.


00:24:43
Chris: Anyway, they’re probably all still just addicted to weird formatting peccadilloes from their FORTRAN days.


00:24:49
Ned: Yeah, that tracks.


00:24:50
Chris: Now, you might be asking yourself, “Self, what is the argument for tabs?”


00:24:57
Ned: What is the argument?


00:24:58
Chris: So, since the internet has no memory at all, and this isn’t a TikTok, and everyone’s probably forgotten that FORTRAN even exists, this argument brought itself to the height of popularity as a minor plot point on Silicon Valley. To remind everybody, Richard, who was sitting on the couch coding alongside a potential beau, gets more and more irritated by her hitting the spacebar a bunch of times. Then he pretends not to be annoyed by it, but gives his famous line, quote, “Truth be told, I do have a slight preference for tabs, but that’s only because I’m anal and because I prefer precision.” Unquote, which, if you watch the show, you probably already know that Richard is an ass. He’s also wrong.


00:25:44
Ned: [laugh]. Indeed.


00:25:45
Chris: With that quote, he’s being elitist and wrong. Tabs are not precise. Please see point one from above. But that’s basically it. That’s my totally fair and unbiased scientific analysis of the situation. People who use tabs are snotty about it, and people are just afraid to admit that they’re wrong.


00:26:02
Ned: All right.


00:26:03
Chris: Now, we come to another annoying thing. Go.


00:26:08
Ned: No, you go.


00:26:09
Chris: [laugh]. You’ve been waiting all episode for that, haven’t you?


00:26:13
Ned: [laugh]. I really have. Felt good.


00:26:16
Chris: Back in the day, advertising company Google created a language called Go, which is great because it’s just about the most generic name possible, thus ironically, making it really hard to Google.


00:26:25
Ned: Mm-hm.


00:26:27
Chris: But what Google did is kickstart the tabs versus spaces war by including in their formatting requirements, this line, quote, “Indentation: we use tabs for indentation, and gofmt emits them by default. Use spaces only as you must.” Unquote, list this mean? Gofmt is short for ‘Go formatting,’ and if you use spaces, it will turn them into tabs. So, use spaces if you must, but they’re getting removed before compilation. Now, this is a pretty funny piece of absolutism, considering Go opens its formatting statement at the top by saying, quote, “Formatting issues are the most contentious, but the least consequential”—


00:27:08
Ned: I mean, they’re not wrong.


00:27:09
Chris: Finally, something we can agree on. “People can adapt to different formatting styles, but it’s better if they don’t have to, and less time is devoted to the topic if everyone adheres to the same style.” Unquote. So basically, if I’m reading this correctly, what they’re saying is, “Buddy, formatting doesn’t matter, right? So, everyone has to do it our way, even though it’s the wrong way.”


00:27:35
Ned: Yeah.


00:27:37
Chris: Sidenote, Google, as we all know, officially stopped using “Don’t be evil” as a corporate mantra, actually, in 2018, which is closer to now than I thought it was. But this bullshit with tabs in Go happened when Go was first released back in 2009.


00:27:53
Ned: Mmm.


00:27:54
Chris: So, for a lot of us, yeah, the writing was on the wall.


00:27:58
Ned: Woke up and chose violence. I get it.


00:28:01
Chris: Come to this situation with Go with probably the most popular programming language on the planet right now.


00:28:07
Ned: It’s got to be pretty close.


00:28:09
Chris: Python.


00:28:09
Ned: Yeah.


00:28:10
Chris: Python takes a, “Space is encouraged, in fact, they matter,” approach.


00:28:15
Ned: I know people can’t see this, but I’m giving it the thumbs down because this is the one thing I don’t like about Python.


00:28:21
Chris: It starts some fights, I know that. So, why does this happen? It happens because in order to put code into blocks that are connected in some way, you’ve got to use spaces, and the exact same amount of spaces for indentation. What in the hell am I talking about? So, in other languages, you have specific markers to open and close small blocks of code. Think about a function—really, it could be an if statement: if a number is odd, do one thing; if a number is even do the other thing—that if statement is in a block, right, because it’s all one little logical piece that’s larger than one line. Now, in C, you have open curly bracket, then you blob in all your code, then closed curly bracket. In bash, you simply name the kind of block function you’re creating. So, for the if statement that I just made you open with ‘if’—you know, the word if—then your logic, then ‘fi.’ Get it? It’s if backwards.


00:29:23
Ned: I get things. You’re very clever.


00:29:25
Chris: This—I didn’t write it, but I will take credit for it.


00:29:28
Ned: Fair.


00:29:29
Chris: This is even easier in Pascal, where you open a block with ‘begin’ and you close the block with—


00:29:36
Ned: What whoo?


00:29:37
Chris: You want to guess?


00:29:38
Ned: NIGEB?


00:29:39
Chris: [sigh].


00:29:41
Ned: No?


00:29:42
Chris: Go back to bed. You end the block with ‘end.’


00:29:45
Ned: Fine [laugh].


00:29:47
Chris: This is logical. And it’s something that you can do without having to worry about tabs or spaces at all. In Python, you have to use spaces. You start your if and you go space, space, space, space, logic line. Next line. Space, space, space, space, logic line. Next line. This is better somehow? Now, on the one hand, it does force you to use indents, which, again, as stated makes the code easier to read.


00:30:13
Ned: It does.


00:30:14
Chris: You do C or bash or Pascal, you don’t have to indent those lines. You use those separators or the code blows up in your face, but you don’t have to indent. On the other hand, this forces you to use exactly four spaces. Use three by accident that one time? Runtime error. Use four spaces once and a tab next? Might work. Who the hell knows? I do not suggest you try it. You will forget.


00:30:43
Ned: It depends on your IDE.


00:30:45
Chris: Right. This issue comes up again with that bastard next door neighbor of Python, YAML. YAML similarly mandates a rigid use of spacing, and a whole bunch of other stuff to denote fields, types, values, et cetera, basically everything. And it regularly infuriates people who are new to it. And people who are not new to it.


00:31:09
Ned: It’s not just the spacing. It’s the fact that there’s usually three different ways to express the same data structure, and the way that you choose to do it is totally up to whatever that person was feeling that day.


00:31:21
Chris: Right.


00:31:23
Ned: And I hate it.


00:31:24
Chris: Try to throw a tab into a YAML file? I wouldn’t recommend it.


00:31:28
Ned: Nope.


00:31:29
Chris: Inscrutable errors as far as the eye can see.


00:31:31
Ned: Whoo.


00:31:33
Chris: Sidenote, when I teach my Intro to AWS class, we go spend a lot of time on CloudFormation, which takes its inputs in—you guessed it—YAML.


00:31:43
Ned: Sure does.


00:31:45
Chris: Friends, Romans, countrymen, YAML somehow is a critical component of the IAC ecosystem, on native AWS especially, and frankly, I don’t know what we did to deserve this.


00:31:59
Ned: Oh, it extends far beyond that, sir, into Kubernetes, and all manner of configuration files. Basically, all of modern infrastructure and applications runs on a pile of YAML.


00:32:12
Chris: Which actually, I think if you translate YAML, from the original Romanian, it does just mean dogshit.


00:32:19
Ned: [laugh].


00:32:21
Chris: In conclusion—well, I mean, I think I nailed the conclusion ten minutes ago with that three point list, but I just went ahead and kept on talking.


00:32:29
Ned: Yep.


00:32:30
Chris: The best conclusion I can probably make, probably, comes from the end of that bit on Silicon Valley. Richard loses that argument, in a spectacular fashion, looks like an idiot because he’s an idiot—just like tabs—and he doesn’t get to go on a date because of his idiot-ness. Also, just like tabs. I’m just saying that soda called Tab: discontinued. Coincidence? I don’t think so.


00:32:57
Ned: Ouch.


00:32:59
Chris: So, don’t be like Richard. Use spaces, and go on dates. The end.


00:33:05
Ned: You know, if we could circle back to the point you were making about spaces versus tabs, I didn’t think I had a real feeling or dog in this fight, but I got to agree with you on the spaces thing because when I’m in an editor and I need to indent a line, I always use spaces because I know exactly how many spaces are being put there, and a tab is a mysterious character that I can’t see in my document because it’s not represented literally by that character, and so I’m never quite sure what it’s going to render out to.


00:33:39
Chris: Right.


00:33:40
Ned: And it’s that little bit of uncertainty that makes me more comfortable hitting the spacebar four times, or letting my editor do it for me—which it will—than having to hit tab and not knowing exactly what I’m going to get. Hey, thanks for listening or something. I guess you found it worthwhile enough if you made it all the way to the end, so congratulations to you, friend. You accomplish something today. Now, you can go sit on the couch, bang on the spacebar to your heart’s content, and watch, I don’t know, Silicon Valley reruns. Why not? You’ve earned it.


You can find more about this show by visiting our LinkedIn page, just search ‘Chaos Lever,’ or go to our website, chaoslever.com where you’ll find show notes, blog posts, and general tomfoolery. We’ll be back next week to see what fresh hell is upon us. Ta-ta for now.


00:34:36
Chris: Funnily enough, I didn’t even have time or a way to fit it into the episode, but the reason this whole thing came up is that Linus got all shitty about somebody talking about tabs versus spaces in the kernel—


00:34:46
Ned: [laugh].


00:34:48
Chris: And he basically was like, “I choose to”—talk about, “I choose violence.” He was like, “I’m going to throw some random tabs in here, and if your interpreter [can’t 00:34:54] interpret it, it shouldn’t be interpreting the kernel.”


00:34:57
Ned: All right. Shade thrown. Good job, Linus [laugh].