4 ms·
I think there's another, equally-good answer: "I don't care, as long as it is consistent per codebase." I work on a codebase that my team owns, and we use spa
by 2bitencryption 4y ago
I think there's another, equally-good answer:
"I don't care, as long as it is consistent per codebase."
I work on a codebase that my team owns, and we use spaces. I work on another codebase another team owns, and it uses tabs. I use whatever the codebase wants.
- jaywalk 4y agoYour answer isn't equally-good, it's worse. The argument for tabs is that each user can set them to display however they'd like. That's obviously not possible with spaces. So tabs make more sense.
- lesuorac 4y agoWhy isn't it possible with spaces? If an application is capable of rendering a tab as say N px of white space why can't it render 2 spaces as N px of white space?
- undersuit 4y agoBecause if someone sends me 8 space code and I'm normally 2 space code rendered as 4 spaces...
- lesuorac 4y agoAnd if they send you a 8 tab'd code and you normally only use 2 tab's then you'd have an issue as well.
- munch117 4y agoThen your editor renders the 8 space code as 4 spaces without missing a beat. Why wouldn't it? Detecting the indentation level used is trivial. (Provided, of course, that the author had the foresight to use spaces, not tabs.)
- undersuit 4y ago>Detecting the indentation level used is trivial. I agree that parsing a known correct file is trivial. Wouldn't a trivial thing be solved by now?
- munch117 4y agoWhenever I open a C file in Emacs, the indentation level is autodetected. I'll admit that may not have been trivial to implement, but it certainly has been done.
- chomp 4y agoIt is possible and there's IDE extensions for this at minimum for VSCode, it's just impossible to be consistent with tab indents, because you'll inevitably have to align with a space.
- lesuorac 4y ago> it's just impossible to be consistent with tab indents, because you'll inevitably have to align with a space. That's definitely application specific. I've seen other applications (not IDEs) use variable width tabs so that tabular data (Tables) would line up very well with only a single tab.
- deleted 4y ago[deleted]
- neltnerb 4y agoMore importantly, some people can only see maybe a dozen characters at a time due to vision impairment. To me, "can someone without good vision work with this code" was all the argument needed. Preferences, sure, accessibility though? Why not just make it simple? Rust also disappointed me on this, I just have never heard an argument for spaces that comes close to functional rather than just aesthetic. I don't honestly know why this is such a controversial topic.