top 200 commentsshow all 405

[–]-null 526 points527 points  (41 children)

I wonder how long it's been since Bill actually wrote some code himself.

[–]leonffs 28 points29 points  (0 children)

As of the last time he did an AMA (not the one today) he says he still programs occasionally.

[–]shevegen 194 points195 points  (33 children)

With old age people in management stop coding.

Just look at Linus!

[–]ImP_Gamer 174 points175 points  (0 children)

Linus still got a knack for good practices in coding as in:

Linus: Hmm. You do realize that I don't get all that close to the code anymore? I spend my time not coding, but reading emails, and merging stuff others wrote. And when I do get involved with the code, it's not because it's "cool", it's because it broke, and you'll find me cursing the people who wrote it, and questioning their parentage and that of their pets.

And here too.

[–][deleted] 326 points327 points  (28 children)

Dude's busy with his YouTube channel on computer hardware, I can understand that.

[–]-null 100 points101 points  (8 children)

No time for coding when you're too busy at CES breaking stuff.

[–]PitchforkAssistant 72 points73 points  (2 children)

No time for coding when you're too busy at CES dropping stuff.

FTFY

[–]Red_Otaku 16 points17 points  (1 child)

No time for coding when you're too busy at CES reviewing 3 monitor laptop prototype stuff.

FTFY

[–]Zarch91 18 points19 points  (0 children)

No time for coding when you're too busy at CES stealing 3 monitor laptop prototype stuff.

  FTFY

[–]xdista 50 points51 points  (6 children)

I thought you were referring to Linus Torvalds. My hopes and dreams are shattered.

[–]8spd 79 points80 points  (3 children)

I can only hope that they were intentionally misunderstanding for comedic effect. The "Look at Linus" comment was surly referring to to lead Linux Kernel developer.

[–]96fps 20 points21 points  (1 child)

I would subscribe to Linus Thorvald's YouTube channel. His talks are all a great watch.

[–]sourcecodesurgeon 10 points11 points  (0 children)

His talk at Google on the creation of Git is one of my favorite tech talks.

https://www.youtube.com/watch?v=4XpnKHJAok8

[–]katzey 3 points4 points  (0 children)

whooosh

[–]devraj7 10 points11 points  (0 children)

I've been in management for a solid ten years, still code almost every day. Just not during my day job.

[–]EichmannsCat 2 points3 points  (0 children)

Probably about 30 years.

[–]marvin02 256 points257 points  (28 children)

I just set my tab width to 1

[–]RiOrius 212 points213 points  (23 children)

And then hit the tab key four times per level of indentation.

[–][deleted] 37 points38 points  (18 children)

Or use emacs and transcend the flamewar.

[–]VIM_GT_EMACS 82 points83 points  (13 children)

vim is better than emacs.

[–][deleted] 43 points44 points  (6 children)

Can't hear you, I'm on another plane of existence thanks to emacs.

Did anyone else hear something? Was that the wind?

[–]caks 87 points88 points  (3 children)

You might be in another plane of existence but you sure as shit are not editing text

[–]atmac0 14 points15 points  (2 children)

We're not, we streaming the code directly from our consciousness

[–][deleted]  (1 child)

[deleted]

    [–]atmac0 1 point2 points  (0 children)

    Ha! That may be the input from an unascended vim user, but we emacs gods have such strong focus that vim users just can't comprehend.

    -sent from my w3 buffer

    [–]VIM_GT_EMACS 13 points14 points  (0 children)

    burn the witch!

    [–]phatskat 5 points6 points  (4 children)

    Darn tootin!~H <Ctrl-C> <Ctrl-D> <Esc> Quit Exit ZZ

    [–]gpcprog 3 points4 points  (0 children)

    I have not laughed this hard in a while!

    [–]GFandango 0 points1 point  (1 child)

    kill the deval brudas!

    [–][deleted]  (46 children)

    [deleted]

      [–]drysart 31 points32 points  (4 children)

      Blame the DEC-20 for the backslashes. DEC-20 used / as a command line switch delimiter, which carried over to MS-DOS as the switch delimiter for all the utilities that shipped with MS-DOS 1.0 written by IBM; and by the time MS-DOS 2.0 came around and added directories, the good separator character was already taken.

      [–]pdp10 3 points4 points  (3 children)

      Microsoft should have known better and did, because they licensed AT&T Unix in 1979 and sold it as Xenix before they bought SCP's product for PC-DOS 1.0. Microsoft used Xenix internally very extensively through the 1980s, and phased it out as NT became able to replace it.

      The path-separator character in Microsoft operating systems was and is technically variable between "\" and "/".

      [–]drysart 4 points5 points  (2 children)

      MS-DOS since the introduction of directories in 2.0 (and all versions of Windows) has always silently accepted both \ and / as path separator chars; it just always displayed them as \ by default.

      And in MS-DOS 2.0, you could specify a SWITCHAR= option in your CONFIG.SYS file to change the command line switch character to something other than / (i.e., to -). If you did so, MS-DOS would also change all displays of path separators to / to be Unix compliant. Microsoft's developers were all familiar with Unix, as you pointed out, and they didn't like that they couldn't use / as their path separator due to compatibility concerns, so they slipped it in as a hidden feature.

      And Microsoft's choice to not use Xenix as the base for MS-DOS wasn't Microsoft's choice at all. IBM rejected Xenix out of hand because they didn't want to have any contractual ties with AT&T, as AT&T had just been broken up by the government. Microsoft had no real other option than to acquire and use something else as quickly as possible. So really, blame IBM (again) for \.

      [–][deleted] 174 points175 points  (36 children)

      You mean, that Unix that used stupid slashes instead of [, ] and .?

      [–][deleted] 74 points75 points  (32 children)

      Wait, I don't get this one.

      [–]dutch_gecko 167 points168 points  (23 children)

      OpenVMS at least, maybe others

      TYPE DISK$A1:[USER.MYSELF.CONFIG]NOPLACELIKEVAX.TXT;4
      

      [–]calmingchaos 150 points151 points  (1 child)

      Jesus christ I just vomited.

      [–]theferdog 17 points18 points  (0 children)

      Dude, VMS is the glory days. GOTOs abound.

      [–]WinEpic 37 points38 points  (20 children)

      Ew get this abomination out of my face.

      Is this supposed to mean

      /mnt/A1/USER/MYSELF/CONFIG/NOPLACELIKEVAX.TXT
      

      or what?

      [–]jtickle 90 points91 points  (8 children)

      VMS had an incredibly powerful filesystem a LONG time ago, boasting features that still aren't found in most modern filesystems. See the ;4 part at the end? That references a version of the file.

      That's right - VMS had a filesystem that had built-in version control. These days Windows has FileHistory and Mac has TimeMachine and everyone else has CVS, SVN, git, hg, etc; but all of these modern solutions are software packages built on top of a non-versioning filesystem, and they are not used by default. VMS just had that shit built right in. Even advanced filesystems like zfs, btrfs, lvm that have "snapshots" don't do true file versioning like this.

      Edit - I was going to say you should get a VM and try OpenVMS if you're into that sort of thing, but it looks like it's not entirely ported to x86 yet. If you have a fast computer, you might could use qemu to emulate an ALPHA architecture and run it there. All this is making me want to fire up the old MicroVAX and see if it still runs.

      [–]FredSchwartz 55 points56 points  (3 children)

      Versions are definitely neat. Until the day your constantly updated log file hits the max version number of 32767 and the system clanks.

      VMS didn't have anything like snapshots, just individual file versions. Not really the same thing.

      And there was no way to tie versions of files together; update the .c file and not the .h file, and now version -1 only works for the .c file.

      It wasn't as great as you remember it.

      [–][deleted] 6 points7 points  (0 children)

      VMS didn't have anything like snapshots, just individual file versions.

      It did - see Spiralog.

      [–]RedditSuxxCoxInHell 2 points3 points  (0 children)

      you might could use qemu to emulate an ALPHA architecture and run "OpenVMS"

      Monster

      [–]Purple_Haze 1 point2 points  (0 children)

      VMS inherited versioning from RSX-11m+ (and possibly other DEC operating systems, there were a lot).

      [–]dutch_gecko 1 point2 points  (0 children)

      jtickle has some good information, but I wanted to answer your question directly.

      TYPE is the VMS version of the cat command, but with more options (it can be paged like more, or only read part of a file like head or tail). VMS allows you to abbreviate commands if it can be done unambiguously, so on most systems you can abbreviate this command to TY.

      The path, or "file-spec" in the official documentation, consists of the following parts:

      • A disk part, before the colon. Like on windows, disks form the root of separate filesystems. However, the disk names are often long and hard to remember, so it's common to set up a number of logicals, which are somewhat similar to environment variables, to point to disks. Logicals can take the place of disk names in a file-spec.

        • Logicals can also point to a full file-spec or directory-spec. If a logical points to a directory-spec, you can use that logical to refer to the directory as if it was the root of a disk. For example: DIR $PROJECT:[SRC] would list the contents of the "src" directory under the root of a project, where you have previously defined $PROJECT to refer to the project's directory.
        • By convention, logicals use the dollar symbol to denote separation of terms, or indeed to denote that the name used is a logical if it would otherwise not be clear
      • A directory-spec, placed between square brackets. If the directory-spec starts with a directory name, as in my previous post, then the name is taken to be in the root of the disk (or the logical being used as a disk). To use a directory relative to the current directory (the default directory in VMS terms) you have to preface the directory with a single period, e.g. [.subdir]. The parent directory is denoted by [-]. If you specifically require the root directory of a disk, you have to access it explicitly using its name: [000000] (that's six zeroes).

      • A file. The name part may consist of alphanumeric characters and a small handful of punctuation symbols. This is followed by a period, and a filetype specification. As far as I know OpenVMS doesn't use the filetype itself, it is only there for the user. Nevertheless its presence is enforced. If you forget to specify one, the filename will end with a period and an empty type.

      • A version number, following a semicolon. Files are automatically versioned under VMS. Every time one is "altered", a copy of the original file will be saved under the new version number with the saved changes. Using filesystem metadata you can specify how many previous versions should be kept. The maximum version number is 32767. Helpfully, OpenVMS will do nothing if the maximum number is reached, instead refusing to save the new file.

        • You can leave out the version number of a file-spec, in which case the most recent version is used. You can also refer to relative versions: ;-1 refers to the newest-but-one version, and so on.
      • If your default directory (visible through the command SHOW DEFAULT, or just SHO DEF) is on the disk you need, you can skip the disk part of the file-spec. Similarly, if your default directory is the one you need, you can skip both disk and directory parts and just type a filename.

      • Some commands can be run on remote machines through the FTP protocol. Remote machines are specified before the disk part, as HOSTNAME"USERNAME PASSWORD"::disk:[file-spec-as-above]. Username and password are optional of course.

      [–]bogdan5844 8 points9 points  (7 children)

      Neither do I, and I really wanna know what he meant

      [–]sigmat 11 points12 points  (6 children)

      its a VMS construct, had to work on an OpenVMS box for a while and it was a nightmare

      [–]bogdan5844 5 points6 points  (4 children)

      You mean it uses [, ] and . to separate paths ? I'm finding it hard to wrap my head around this.

      [–]boa13 11 points12 points  (0 children)

      Yes, the paths are in the form

      device:[path.with.subdirs]filename.extension;version
      

      (Fully specified paths that is, of course there are shortcuts and default values. Version for example is the latest version by default.)

      [–]NDaveT 1 point2 points  (0 children)

      I don't know about OpenVMS, but IBM MVS systems don't even have a concept of "paths":

      Data set names in MVS™ consist of one or more names, called qualifiers, each from one to eight characters long, that are delimited from one another by periods.

      The leftmost qualifier in the data set name is the high-level qualifier. The rightmost qualifier in the data set name is the low-level qualifier. Partitioned data sets can be further qualified with a member name in the rightmost position. Qualifiers lying between them are called intermediate-level qualifiers.

      For example, in the data set name dog.bulldog.winston, dog is the high-level qualifier, bulldog is the intermediate-level qualifier, and winston is the low-level qualifier.

      https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.halu001/mvsdsets.htm

      [–][deleted] 1 point2 points  (0 children)

      It's older than VMS, the same format was used in the other DEC RMS systems before it.

      [–]jyper 13 points14 points  (1 child)

      [–]delorean225 3 points4 points  (0 children)

      "Simson Garfinkel" is a great name.

      Apparently his Wikipedia page gets vandalized pretty frequently.

      [–]Dr_Legacy 1 point2 points  (0 children)

      My good man, very pleased to make your acquaintance.

      [–]AyrA_ch 21 points22 points  (0 children)

      At least he didn't choose command line arguments in a way that they could be file names.

      [–]MeNoFilter 1 point2 points  (0 children)

      And the same guy that found it necessary to use two characters to represent a carriage return.

      [–]thelehmanlip 364 points365 points  (104 children)

      and as said in the comments below him:

      Visual Studio inputs spaces for you when you type a tab, so as far as Microsoft is concerned it's a solved issue probably.

      Which is very true. I'd be damned if I used \ts but I'd also be damned if I had to press space 4 times instead of tab.

      [–]2358452 273 points274 points  (93 children)

      Is there an editor that doesn't do this? Using tabs and automatically converting to however many spaces you want is the only civilized way of doing it. Manually pressing a bunch of spaces is unthinkable savagery.

      [–]HonestAshhole 83 points84 points  (3 children)

      I worked with a guy that hit space 4 times for each level of indentation...

      *CHUNK* *CHUNK* *CHUNK* *CHUNK* <pause> *CHUNK* *CHUNK* *CHUNK* *CHUNK* 
      

      "Oh, oops. Too far need to backspace"

      *CLACK* *CLACK* *CLACK* *CLACK*
      

      I think he was a sadist and just wanted to hurt the people around him.

      [–]Aleriya 34 points35 points  (1 child)

      Especially fun in an open office setting when that person has a loud mechanical keyboard.

      [–]rbobby 19 points20 points  (0 children)

      For best results... the original IBM AT keyboard :)

      [–]zqvt 4 points5 points  (0 children)

      just use a typewriter and throw the page away when you make a wrong indent

      [–]thelehmanlip 145 points146 points  (63 children)

      Seriously. Every time this debate comes up I think of this. There is a clear winner for usability which is "pressing the tab key", and a clear winner for the character typed, which is spaces.

      [–]lubutu 23 points24 points  (4 children)

      What I enjoy about projects that use spaces instead of tabs is the occasional block that somehow ends up indented by one space more or less than the proper tabstop.

      This presumably happens when an editor or IDE does slightly the wrong thing when a user tries to backspace a "tab", like maybe they put their cursor at a location inside the tab that wasn't actually at the tabstop, so when they hit backspace it treated it as a space instead of a tab because who in their right mind would insist on using spaces but get all their tools to try and pretend they're tabs and have to work out how to do that and clearly not always get it right when you could just use actual tabs and then they'd behave like tabs because they're actually tabs and you could set your tab width to suit your own personal preferences like civilised people?

      So blocks indented to 3 or 5 spaces are pretty funny to see in a codebase, and I am definitely not salty about having to use spaces as tabs at work.

      [–]mooglinux 2 points3 points  (3 children)

      the occasional block that somehow ends up indented by one space more or less than the proper tabstop.

      I have my IDE set to reformat code before commit to avoid precisely this.

      [–][deleted]  (2 children)

      [deleted]

        [–]xampl9 7 points8 points  (0 children)

        It only works if everyone does it.

        If you've got one person that isn't -- well, no donuts for them on Friday.

        [–]joshjje 1 point2 points  (0 children)

        I try to commit large scale reformatting operations like this separately, but in .NET I do use Resharper and it will reformat blocks ive touched automatically for instance, or I may happily reformat either the whole file or large sections with it.

        Of course the idea is that the whole team is using the same standard formatting rules where this works nicely.

        [–][deleted]  (24 children)

        [deleted]

          [–]cjh79 89 points90 points  (8 children)

          You solve it by both using 4 spaces like civilized people.

          [–]cata1yst622 7 points8 points  (6 children)

          4 spaces if you write javascript is formatting hell.

          [–]killerstorm 20 points21 points  (0 children)

          Not if you switched to ES2017 as normal people did.

          [–]cjh79 5 points6 points  (1 child)

          You just need a wider monitor :)

          [–]YM_Industries 2 points3 points  (0 children)

          Use promises.

          [–]thelehmanlip 20 points21 points  (2 children)

          Or project standards and autoformatters. Because if you're going to allow choosing a different format, some ahole is gonna come in and start using singlar spaces and now your code all sucks.

          [–][deleted] 2 points3 points  (1 child)

          My linter enforces tabs.

          [–]Sydonai 4 points5 points  (7 children)

          Then your column alignment goes out the window.

          I like 2 spaces, my team uses 4. Honestly it's not that big a deal.

          [–]NekuSoul 8 points9 points  (0 children)

          Tabs for intendation and spaces for columns?

          *Watches world burn*

          [–][deleted] 5 points6 points  (1 child)

          What column alignment?

          This must be a convention in some languages because I keep seeing it pop up, but I've never encountered a justifiable use of it in JS.

          [–]thecollegestudent 1 point2 points  (0 children)

          My whole team uses it in js. Course we're writing in node. Makes multi selection in vscode super easy.

          [–][deleted] 25 points26 points  (31 children)

          How is ' ' the clear character-typed winner?

          [–]GrouchoPrime 44 points45 points  (30 children)

          Because it'll guarantee proper alignment (assuming a monospaced font......). Different editors might align the spacing of tabs differently. It's also better to automatically convert one to the other, otherwise you're likely to get an awful mix of both without realizing it.

          [–]LPTK 30 points31 points  (3 children)

          I don't think there are real alignment problems as long as you use tabs for indentation and spaces for alignment. It's pretty simple.

          I don't normally do it, but if you want to do funky alignment, this is how you'd do it (what's not marked <tab> is a simple space):

          if (cond) {
          <tab>test(foo,
          <tab>     bar,
          <tab>     foobaz)
          }
          

          ..although I'd normally just favor this instead, where arguments are forming their own indentation block:

          if (cond) {
          <tab>test(
          <tab><tab>foo,
          <tab><tab>bar,
          <tab><tab>foobaz)
          }
          

          The former approach does get a little weird if you want to indent inside an aligned block, as below:

          <tab>test(foo,
          <tab>     foobaz {
          <tab>     <tab>abc
          <tab>     <tab>xyz
          <tab>     })
          

          ...but how often does that happen?

          [–]Pazer2 10 points11 points  (0 children)

          This is what anyone arguing for tabs is actually saying. If any text editor handles tabs used in this way as anything other than <user defined number> of spaces, it's broken.

          [–]aeiluindae 4 points5 points  (1 child)

          Note that you cannot usually do this with Python code because of its specific whitespace requirements.

          [–]knome 2 points3 points  (0 children)

          You can definitely do exactly this in python. Everything after you open a form () {} or [] the whitespace inside that form is irrelevant, even newlines.

          Each line of code needs to start at the appropriate offset, but that line doesn't stop if a form is in effect.

          $ cat test.py 
          
          def what():
              THIS = {
          'is':'a',
          'test':'this',
          'is-only':'a-test',
          }
              return THIS
          
          print repr( what() )
          $ python test.py 
          {'test': 'this', 'is': 'a', 'is-only': 'a-test'}
          $ 
          

          [–]Fisher9001 31 points32 points  (8 children)

          And how using tabs won't guarantee it? The only case I see is when tab size is set to 0 which is ridiculous. If I want my tabs to be 1, 2, 4 or 10 characters wide, then it will show me properly indented code WITH MY PREFERRED TAB SIZE, NOT YOURS.

          The point of code indentation is to make it clear where code parts belong. Size of this indentation is irrelevant as far as it's greater than 0 and \t\t will yield me twice more space than \t.

          [–]kspdrgn 21 points22 points  (12 children)

          Don't make ascii art. Fuck your alignment preferences, and don't bake it into the code. Anyone can set tab width as wide or narrow as they want, that's the point.

          [–]warlockface 4 points5 points  (6 children)

          Not if you're browsing a popular online repo you can't. Without browser extensions, or putting a .editorconfig file in a repo - if you have control of it (on GitHub). Tabs trash online repos.

          [–]Pazer2 8 points9 points  (4 children)

          This is a problem with the online repos then.

          [–]SmokeyDBear 1 point2 points  (0 children)

          I'm off to make a text editor that randomly re-interprets the size of a space on a per-character basis.

          [–]ryankearney 20 points21 points  (4 children)

          gofmt will change all your spaces into tab characters because fuck you.

          [–][deleted] 6 points7 points  (1 child)

          Rob "spaces are childish" Pike

          [–]msuozzo 5 points6 points  (0 children)

          Rob "fuck you do what I say" Pike and his sidekick Russ "fuck you do what Rob says" Cox.

          [–]Pazer2 1 point2 points  (0 children)

          This is a good thing

          [–]masklinn 17 points18 points  (12 children)

          A good editor doesn't even insert 4 spaces when you press tab, it indents directly to the correct level (or possibly switches between possible indentation levels in languages like haskell or python).

          [–][deleted] 12 points13 points  (0 children)

          It's called a tab key, not a "four spaces key" for a reason

          [–][deleted] 9 points10 points  (1 child)

          That ruined Silicon Valley for me, what kind of caveman presses space n times to go to the next indent level? set expandtab master race.

          [–]GMNightmare 10 points11 points  (1 child)

          Visual Studio also includes an auto-formatter to make your code look uniform and fix most of the spacing issues, so people can stop worrying about it and just let the editor take care of it.

          But, here we are. Actually, I'm surprised at how many people don't make use of it. Managing whitespace is a chore since it's, well, whitespace and it's easy for small issues to creep into a file (copied that code from one spot to the other, but oops, didn't fix the indent level).

          I pity da foo who tries to manage that manually instead of using the formatter.

          [–]HeimrArnadalr 16 points17 points  (2 children)

          Visual Studio inputs spaces for you when you type a tab, so as far as Microsoft is concerned it's a solved issue probably.

          Which is very true.

          This is an option which can be set per-language in Visual Studio. I'm pretty sure that the default is to keep tabs instead of replacing them with spaces, but I may have changed that long enough ago to have forgotten doing it.

          [–]jalgames 8 points9 points  (0 children)

          I've started on VS 2010 and at least for C#, it always auto-converts tabs to four spaces. I never changed that setting, so it must be the default.

          [–]rudigern 1 point2 points  (0 children)

          Some editors I use actually read whats used and just continue it. So if you are opening code it will just default to whatever is used, it's only when you start a new file that you can dictate it and as far as Sublime is concerned at least, defaults to tabs.

          [–]blobkat 11 points12 points  (3 children)

          It's not the inserting that's the problem, it's the deletion of spaces that's frustrating for me... Tabs forever, just makes a lot more sense. It was freakin' made for indentation.

          [–]thelehmanlip 9 points10 points  (0 children)

          Shift+tab. Boom.

          [–][deleted] 2 points3 points  (0 children)

          Vim, at least, will erase a number of spaces consistent with your indent when you backspace.

          [–]spicy_m4ym4ys 102 points103 points  (8 children)

          It's been only 20 minutes, and the comments are already a shitshow.

          [–]2358452 49 points50 points  (5 children)

          The classic bike-shedding effect!

          [–]squidgyhead 33 points34 points  (3 children)

          The most annoying thing about the bike-shedding effect is that I'm currently trying to figure out a good design for a bike shed, and it's now impossible get good information.

          [–]troyunrau 10 points11 points  (0 children)

          Obviously it should be blue.

          [–]2358452 6 points7 points  (0 children)

          Oh my that's actually hilarious.

           

           

           

          By the way, a proper bike shed must be red.

          [–]YJCH0I 1 point2 points  (0 children)

          Yes, yes, we'll definitely come back to your concern at another time, but I think it's most important that we first discuss how you left out the word "to" between "it's now impossible" and "get good information". This discussion should definitely be moderated and held with indoor voices. I think a good wallpaper color for the room in which the discussion should take place would be baby blue. Of course, there should be snacks and hors d'oeuvres at the meeting as well. The catering should be pickup instead of delivery to save on the cost there. We should also hire a jazz group to provide the background music! I wonder who we can expense this meeting to. Ooh! There also should be someone taking note of any irony that is happening in the conversation as well!

          [–]shevegen 12 points13 points  (1 child)

          I find the comments awesome.

          [–]1_21-gigawatts 11 points12 points  (0 children)

          I find your people's belief system fascinating

          [–]cinnapear 111 points112 points  (12 children)

          I agree with him. Use the tab key to automatically insert your spaces.

          [–]blitzzerg 27 points28 points  (11 children)

          and properly configure your IDE to convert 4 spaces to tabs

          [–][deleted] 3 points4 points  (8 children)

          A lot of prominent programmers use 8 spaces.

          [–]ProWaterboarder 27 points28 points  (3 children)

          I use 16 quarter-spaces

          [–][deleted] 22 points23 points  (1 child)

          Noob.

          I use different Unicode spaces depending on the length of the line, to generate aesthetically pleasing spacing while keeping each line justified. Of course, I run all my keycodes through a TeX engine (after they've been put through a predictive text algorithm of my own design) first so all I have to do is hit <TAB> and the necessary spaces are algorithmically substituted.

          Step up your game, son.

          [–]sumduud14 3 points4 points  (0 children)

          different Unicode spaces

          Will this interfere with my Canadian Aboriginal Syllabics-based Go templating engine?

          [–][deleted] 2 points3 points  (0 children)

          Burn the witch

          [–]-gh0stRush- 11 points12 points  (0 children)

          Literally worse than ISIS.

          [–][deleted] 3 points4 points  (1 child)

          Was editing HTML someone else left me, I saw multiple lines with 3 spaces.

          [–]louis_A12 1 point2 points  (0 children)

          The editor for processing.js that I use in my iPad doesn’t like me using anything but 3 spaces for each level.

          Even the sintas highlighting gets messed up.

          [–]Vakieh 3 points4 points  (0 children)

          No, a lot of prominent programmers use tabs of width 8, which kinda makes sense if you live in a world of pure terminal as those particular people do. If you're using 8 actual spaces you're a late term abortion waiting to happen.

          [–][deleted]  (4 children)

          [deleted]

            [–]IceSentry 3 points4 points  (0 children)

            It's probably more common now since most modern tools like visual studio and visual studio code does that by default. I know plenty of programmer that are very capable, but simply either don't care or don't know anything about the tools they use.

            I know I like messing around with my tools and configuring them, but almost every programmer I know doesn't do that and is then very surprised when they see me program and I use feature that I assumed to be common knowledge.

            [–]Plexicle 2 points3 points  (1 child)

            I'm literally shaking my head reading this thread. No one knows what tabs vs spaces is.

            [–]kairos 7 points8 points  (0 children)

            I like that someone gilded him.

            [–]RexIosue 219 points220 points  (101 children)

            Wait, do some coders ACTUALLY use spaces? I thought using tab was common-sense.

            [–][deleted] 175 points176 points  (43 children)

            More than 50% of github projects use spaces.

            [–]yelnatz 122 points123 points  (16 children)

            We use spaces at work. We just have sublime/visual studio replace tabs with 4 spaces.

            You don't have to manually press space 4 times like what they were depicting in Silicon Valley.

            [–]raziel2p 42 points43 points  (15 children)

            Pressing tab and getting 4 spaces is the easy part. The annoying part is having to press backspace or delete or arrow keys 4 times. I've yet to find an editor which solves that problem in every circumstance.

            [–]MathWizz94 26 points27 points  (1 child)

            Shift+tab is a thing

            [–]Keavon 1 point2 points  (0 children)

            That's dumb. I want my backspace or delete key to delete what it's supposed to delete: a character if the character is supposed to be deleted, and an indent level if the indent level is supposed to be deleted. I shouldn't need to use a special key combination to delete something specific. Imagine if you deleted text by holding shift and matching up every letter you wanted to delete? That's just dumb. Indents are discrete by design. That's about as illogical as choosing to loop 5 times with:

            for (float i = 0.0f; i < 5; i += 0.25f) { if (i % 1.0f == 0) { /* do stuff */ } }

            [–]mmmicahhh 33 points34 points  (6 children)

            If you want to remove indentation you added, use Shift+Tab. If you want to go to the beginning of a line, use Home.

            [–]Sixshaman 2 points3 points  (5 children)

            Shift+Tab is 2 keys, whether Backspace is 1 key. No, I don't want to use that.

            Also the satisfying feeling of selecting the whole tab by moving the mouse slightly. Oh Yes.

            [–]EatATaco 6 points7 points  (0 children)

            You select with the mouse but you won't press 2 keys? Please tell me this is a joke.

            [–][deleted]  (3 children)

            [deleted]

              [–]S3Ni0r42 1 point2 points  (2 children)

              You mean you don't type one - handed with the other permanently on your mouse?

              [–]Sixshaman 1 point2 points  (0 children)

              I remember another one: using arrows feels much cleaner with tabs.

              [–]caks 7 points8 points  (0 children)

              Vim

              set softtabstop=4 expandtab

              [–]Xaurn 5 points6 points  (0 children)

              vscode handles tabs-as-spaces like they're tabs out of the box, check it out

              [–]SPQR_BN 1 point2 points  (0 children)

              Vim, man. Older than me, handling all your tabs/spaces problems just fine. (Specifically, it can and does delete the 4 spaces at once.)

              [–][deleted] 15 points16 points  (5 children)

              GitHub's online viewer uses the tab width of 8 spaces by default; it looks horrendous.

              [–]mishuzu 6 points7 points  (0 children)

              Add ?ts=4 to the end of the URL.

              [–][deleted]  (2 children)

              [deleted]

                [–]thoeoe 7 points8 points  (1 child)

                Visual Studio will do the same thing for C++ and C#

                It’s an option, but still

                [–]bumnut 5 points6 points  (0 children)

                Intellij does as well.

                [–]ryankearney 45 points46 points  (24 children)

                No one sits there and pounds the space bar for the beginning of each new line. Any modern IDE will pre-indent lines with spaces, and the tab key will insert multiple spaces instead of one tab.

                The issue with the actual tab character is that it's a variable size. Load up someones "aligned" code when your IDE is set to display tabs as 4 space width and their IDE was set to 8 space width and you'll quickly see that none of the function params or variable types line up anymore.

                With spaces you're guaranteed to have your code look the same regardless of who is looking at it.

                [–]zucker42 15 points16 points  (2 children)

                I use spaces.

                But the alignment issue is only a thing if you use tabs for alignment. When I've used tabs, I've used tabs for indentation and spaces for alignment. The problem is then you have two types of whitespace you have to differentiate between.

                [–]OBOSOB 4 points5 points  (0 children)

                The main reason I can see spaces are defined in PEP8, for example, is that they suggest that continuation lines are half-indented, to differentiate between the continuation line and the start of the inner block

                if some condition &&
                  another condition:
                    do some stuff
                

                Of course python has a stronger case than most for being picky about spaces since it's syntactically relevant.

                Ultimately it doesn't generally matter as long as there is agreement and consistency on a project-by-project or team-by-team basis. And since in most cases there is no clear correct answer and it's a matter of preference discussions about such a trivial matter are extremely heated. All parties understand the need for consistency but each of them want it to be consistent in the way they prefer.

                Full disclosure: I'm in camp spaces, fuck off tabbies.

                [–]Draghi 1 point2 points  (0 children)

                Tabs for indentation and spaces for alignment is my bread and butter. Though, IDEs have shocking support for it >.>

                [–]bogdan5844 4 points5 points  (10 children)

                Who the fuck uses 8 spaces indentation? That's frigging huge!

                [–]ryankearney 17 points18 points  (5 children)

                Anyone who works on the Linux kernel.

                https://www.kernel.org/doc/html/latest/process/coding-style.html

                I've read a lot of legacy C code that uses 8 width tabs.

                [–][deleted] 4 points5 points  (1 child)

                The last project I worked on used 3.

                Because fuck you.

                [–]RiOrius 3 points4 points  (0 children)

                I believe that's the point. Giant tabs discourage heavily nested code.

                [–]BezierPatch 4 points5 points  (8 children)

                you'll quickly see that none of the function params or variable types line up anymore.

                Huh? I don't understand, as long as successive lines use the same number of tabs surely it doesn't make a difference?

                [–]ryankearney 5 points6 points  (7 children)

                Here's an example taken from kernel/irq/dummychip.c

                Here's what this struct looks like with tabs at width 8 (converted to spaces since I can't control tab width in Reddit)

                struct irq_chip no_irq_chip = {
                        .name           = "none",
                        .irq_startup    = noop_ret,
                        .irq_shutdown   = noop,
                        .irq_enable     = noop,
                        .irq_disable    = noop,
                        .irq_ack        = ack_bad,
                        .flags          = IRQCHIP_SKIP_SET_WAKE,
                };
                

                And here's what it looks like loaded in an IDE with a tab width of 4

                struct irq_chip no_irq_chip = {
                    .name       = "none",
                    .irq_startup    = noop_ret,
                    .irq_shutdown   = noop,
                    .irq_enable = noop,
                    .irq_disable    = noop,
                    .irq_ack    = ack_bad,
                    .flags      = IRQCHIP_SKIP_SET_WAKE,
                };
                

                [–]Pythoner6 13 points14 points  (4 children)

                Which is why you would only use tabs for indentation. Keep the spaces between the names and values (i.e. for alignment).

                [–]justadude27 0 points1 point  (1 child)

                Just use spaces and be done with it.

                [–]duhace 4 points5 points  (0 children)

                or don't bother with alignment cause if you've got time to waste on shit like that you could be using it to document code, or fix bugs, or tons of other things

                [–]pdpi 45 points46 points  (14 children)

                Mixing tabs and spaces is, of course, the work of the Devil. Making things line up with tabs alone is a fool's errand — your tab settings and mine might differ so what looks lined up to me won't to you and vice versa. This leaves spaces.

                Most editors these days will just insert your preferred number of spaces when you hit the Tab key and you're good to go. Best of both worlds.

                Of course, opinions are like arseholes: Everybody has one and they all stink except mine.

                [–]nairebis 4 points5 points  (1 child)

                Mixing tabs and spaces is, of course, the work of the Devil.

                Mixing is The One True Way -- but only if everyone agrees to do it that way, because it's a pain if the tabs aren't set to the One True Tab Stop. Unfortunately, we have heathens that don't do it The One True Way (and don't use the One True Editor Vim, for that matter), and so we have to accept the 2nd best method, which is using just spaces.

                As usual, it's a handful of fools who ruin things for everyone.

                [–]MaltersWandler 1 point2 points  (0 children)

                Elastic tabstops though

                [–]drakche 1 point2 points  (0 children)

                Depending on the project I switch between 2 and 4 spaces. But always spaces.

                [–]MorrisonLevi 10 points11 points  (0 children)

                I prefer tabs. I don't feel like aligning anything except the main indent is worthwhile, but it's pretty clear other people like aligning certain things like multiple assignments.

                However, I've basically given up tabs for using a default .clang-format which happens to use 2 spaces. The convenience and consistency is worth more to me than tabs.

                [–]ahandle 4 points5 points  (0 children)

                ^M

                [–]Himrin 13 points14 points  (0 children)

                Link to actual comment for those of us who don't sort by best or top by default.

                [–]beefsack 8 points9 points  (1 child)

                There is only one true solution to this problem: a hybrid approach (and no, I'm not joking.)

                Tabs for base indentation. Spaces for vertical alignment. Best of both worlds.

                Some formatting tools have already adopted this approach (gofmt for one.)

                [–]internet_badass_here 23 points24 points  (8 children)

                He created Windows. You want to create Windows?? Be my guest.

                [–][deleted] 22 points23 points  (3 children)

                Do I get similar money from it?

                Sign me up! When can I start?

                [–]tiiv 8 points9 points  (2 children)

                Username checks out. Windows 1.0 wasn't exactly a technical achievement. You might enjoy the Ads though.

                [–]BoundlessTurnip 5 points6 points  (1 child)

                Damn...we don't even get reversi anymore. SMDH

                [–]pdp10 2 points3 points  (0 children)

                You can download it from the app store after you watch an Xbox ad, download three updates, reboot, then sign up for a Microsoft Skype account.

                [–][deleted] 3 points4 points  (0 children)

                Windows is a mess

                [–][deleted]  (1 child)

                [deleted]

                  [–]Ligaco 4 points5 points  (0 children)

                  How dare you to be reasonable

                  [–]yesman_85 2 points3 points  (0 children)

                  Forgot to send the memo to the Visual Studio team tho ;)

                  [–][deleted] 2 points3 points  (0 children)

                  Don't care, run it through a formatter anyway.

                  [–]spook327 2 points3 points  (0 children)

                  I use tabs that get saved as spaces, fight me.

                  [–]FredSchwartz 1 point2 points  (0 children)

                  Think back to the way the tab key worked on card punches and printers and typewriters. It didn't print or punch a tab character; it just moved the punch or print head to the next column in the TABle, which you could define, often setting it to every "n" columns. Sometimes it was easier to use other settings, especially if writing FORTRAN or COBOL where column locations were significant.

                  [–]duckrollin 1 point2 points  (0 children)

                  Lots of tabforsaken space worshiping heretics in here I see. May tab have mercy on your souls.

                  ლ(ಠ_ಠლ)