News for hackers. Stuff that matters.
Re:Shell Style Guide from Google by paule89 on Saturday June 04, 2016 @06:19PM (#11838418)
Google seems to prefer spaces over tabs
Re:Shell Style Guide from Google by ams6110 on Saturday June 04, 2016 @07:15PM (#11838684)
I prefer spaces. Tabs can render differently in different editors, making alignment harder.

Always irks me when I come across some config file format that only accepts tab delimeters.

Re:Shell Style Guide from Google by ekimekim on Saturday June 04, 2016 @08:31PM (#11839006)
Which is why I take (well, prefer) a third option:

Tabs for indentation. Spaces for alignment.

The idea is you should be able to set any tabstop you like and the code will still align correctly. For example:

    ^Ia_really_long_method(a_very_long_argument,
    ^I                     the_second_argument)
Re:Shell Style Guide from Google by sorenjan on Saturday June 04, 2016 @09:03PM (#11839102)
This is the most logical option. Tabs to add an indentation level, the width of that is unimportant and can be configured by each user. Spaces to align, since they're like any other character in a mono spaced font thereby perfectly matching the line above.
Re:Shell Style Guide from Google by e40 on Saturday June 04, 2016 @08:14PM (#11838931)
And 2 spaces is way too little. 4 is the sweet spot.

Reason: with 2 the visual lines at different indent levels are just too close, in many fonts/sizes.

Re:Shell Style Guide from Google by tomlu on Saturday June 04, 2016 @08:47PM (#11839060)
It's 2 spaces for everything here, even python. I don't like it and don't think I'll ever get used to it, like you say 2 is too little.
Re:Shell Style Guide from Google by rossjudson on Saturday June 04, 2016 @11:07PM (#11839441)
Wrong. 3 spaces is the sweet spot. What is it with you people and powers of two? ;)
Re:Shell Style Guide from Google by lisivka on Sunday June 05, 2016 @10:48AM (#11841220)
It is easy to catch an indentation error with two spaces, while it is harder to make an indentation error with just two spaces. It also easier to type two spaces than 3 or 4 spaces, which is important when program is typed without help of an autoindentation tool. Two spaces are enough for fixed length font, typical in terminal, but also saves screen space, which is just 80 characters in width.
Re:Shell Style Guide from Google by rifung on Saturday June 04, 2016 @07:33PM (#11838755)
Golang uses tabs and not spaces though.. I actually thought everyone used spaces instead of tabs till I had to use it.
Re:Shell Style Guide from Google by riskrisk on Sunday June 05, 2016 @03:00AM (#11839958)
golang also had/has a style guide and a gofmt tool that would indent/align things the same way from the beginning.