News for hackers. Stuff that matters.
Re:Developers Who Use Spaces Make More Money Than Those Who ... by wwweston on Friday August 16, 2019 @02:40PM (#20718219)
In case anyone wonders why someone might answer "both" (other than an entirely undisciplined approach):

Tabs for line indentation, spaces for every other kind of alignment is one philosophy. It's the one that seems to hit the sweet spot for most of the issues that I care about (cross-editor consistent yet flexible management of line indentation depth as controlled by hits of the tab key + tabstop setting).

But if you're running the project and decide spaces are The One True Way™, I'll figure out a way to get the editor to do it for me and ask you for a raise for the trouble (and, of course, market standards). ;)

Re:Developers Who Use Spaces Make More Money Than Those Who ... by umvi on Friday August 16, 2019 @02:44PM (#20718257)
> I'll figure out a way to get the editor to do it for me and ask you for a raise for the trouble

You don't have to "figure out" anything. It's the default of every IDE I've ever used.

I press tab, VSCode inserts 4 spaces. I press shift+tab, it deletes 4 spaces.

Nobody actually presses spacebar 4 times to indent unless they are forced to use vim on some remote machine.

Re:Developers Who Use Spaces Make More Money Than Those Who ... by wwweston on Friday August 16, 2019 @04:04PM (#20719169)
> It's the default of every IDE I've ever used

Which is probably not every IDE or editor.

> I press shift+tab, it deletes 4 spaces.

How entirely intuitive and not-awkward compared to hitting delete.

> they are forced to use vim on some remote machine.

Vim is not exactly unpopular as an editor of choice.

But overarching all that -- the ;) at the end of my comment should have been a clue that I was not sincerely arguing that figuring out how to use spaces for tabs is an involved task. Even somebody using vim (whether forced or by choice) should know `:set expandtab`. Most editors worth investing in will provide a convenient way of doing this.

Rarer are the editors that will also let you change indentation width on the fly while expanding tabs to spaces, though, which is generally easy if you use tab characters for indentation. I'm not super familiar with VSCode, but having just fired it up and tried it out, maybe it can do this if you turn on Detect Indentation, though it doesn't seem to be the default, and I haven't put it through the paces for less trivial cases.

Re:Developers Who Use Spaces Make More Money Than Those Who ... by umvi on Friday August 16, 2019 @04:52PM (#20719585)
> How entirely intuitive and not-awkward compared to hitting delete.

Try it, you'll like it. Especially when you want to untab an entire block of code instead of just one line.

- Highlight entire block of code

- shift+tab unindents entire block (whereas delete would delete entire block)

Plus, once you know a lot of shortcuts, `shift` seems to be sort of a negating key so it actually starts to be intuitive. (i.e. in vim, if you are searching for a string, "n" will move to next match, "shift+n" will move to previous match)

Re:Developers Who Use Spaces Make More Money Than Those Who ... by LordDragonfang on Saturday August 17, 2019 @02:29PM (#20725468)
> > they are forced to use vim on some remote machine.

> Vim is not exactly unpopular as an editor of choice.

I think by "some remote machine" he's implying "default configuration", because vim can be configured to insert spaces; I would know, I have mine set up that way.

Re:Developers Who Use Spaces Make More Money Than Those Who ... by jakear on Friday August 16, 2019 @04:47PM (#20719545)
You can actually just press delete and it will delete a full tab-stop’s worth of spaces.
Re:Developers Who Use Spaces Make More Money Than Those Who ... by godelski on Friday August 16, 2019 @03:25PM (#20718773)
>Nobody actually presses spacebar 4 times to indent unless they are forced to use vim on some remote machine.

My PhD advisor does... His preferred editor is vi (not vim, but vi)

Re:Developers Who Use Spaces Make More Money Than Those Who ... by rhoyerboat on Friday August 16, 2019 @03:02PM (#20718495)
> Nobody actually presses spacebar 4 times to indent unless they are forced to use vim on some remote machine.

Totally, hazard pay factor. ;)

..but I do it because of habits learned in python shell and also because of that cowboy character on the Simpsons cartoon that called himself OCD about the number 4 and then counted 1,2,3,4 tapping his foot and shooting his gun into the air.

Re:Developers Who Use Spaces Make More Money Than Those Who ... by xapata on Friday August 16, 2019 @03:12PM (#20718614)
That was only necessary in Python shell briefly because of a bug. The bug was supposed to be a release blocker, but accidentally got marked incorrectly. It's fixed now, and has been for some time.
Re:Developers Who Use Spaces Make More Money Than Those Who ... by styglian on Friday August 16, 2019 @03:24PM (#20718754)
> Nobody actually presses spacebar 4 times to indent unless they are forced to use vim on some remote machine.

Even then, you can just use >> and << in vim; as long as it's set up correctly it'll insert spaces.

Works with whole sections in visual mode too ("v, down, down, down, >" will indent four lines).

Re:Developers Who Use Spaces Make More Money Than Those Who ... by Izkata on Friday August 16, 2019 @05:23PM (#20719839)
Are you sure you meant vim, not vi? 'Cause...

:set expandtab

Re:Developers Who Use Spaces Make More Money Than Those Who ... by ThorinJacobs on Friday August 16, 2019 @03:05PM (#20718519)
I answered "both" because I'm not running all of the projects I'm working on and some of them prefer tabs and others spaces - so I just go with the convention that that particular project uses.
Re:Developers Who Use Spaces Make More Money Than Those Who ... by forgot-my-pw on Friday August 16, 2019 @02:52PM (#20718356)
This is why tools like gofmt is great. No more debates about spaces vs tabs.
Re:Developers Who Use Spaces Make More Money Than Those Who ... by jakear on Friday August 16, 2019 @04:46PM (#20719531)
The problem with “tabs for indentation, spaces for alignment” is that it voids the claimed tab-benefit of “anyone can configure tabs to be whatever width they want”.