Live data from Hacker News

Tabs or spaces – Parsing a 1B files among 14 programming languages

medium.com

81–90 of 124 posts

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#81
post #30
post #25

Earlier quoted context omitted.

Your point is valid, that's why I write function( really_really_really_really_really_long_argument1, really_really_really_really_really_long_argument2, really_really_really_really_really_long_argument3);

Right, not now you're dictating coding style to work around the warts associated with using tabs. If you use spaces there are no such issues because spaces don't change widths between editors.

The kind of formatting you suggest - aligning with spaces to get beautiful indenting - is a royal pain in the ass to edit. You change the function name to something a few characters shorter and now you have to change all the lines. It's prettier than the alternative, though (I still don't use it).

I wish the pioneers of programming languages would have had the foresight to provide an automatic formatting tool and standardize on a canonical layout. So much time and effort would have been saved.

Further, I think code guideline documents and discussions without an accompanying config file for astyle or clang-format are pretty useless.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#82
post #79
post #27

Earlier quoted context omitted.

Go's adoption rate would be quadrupled if they had chosen spaces instead of tabs. It's a fact.

Fact? My team is using Atom, VS code, IntelliJ and vim-go for Go. There has never been a problem with tabs vs spaces. On save gofmt converts all spaces to tabs and when I open Go files in vim-go it converts them to spaces according to my settings. Same for all other editors, whether you like tabs or 7-space indent.

Pretty sure it was a joke...

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#83
Some perl projects carried by teams, use perltidy as pre-commit hook.

It's not as cool as talk about newer languages, but it handles all you may need about code indenting and alignment. And about tabs and about spaces.

Today somebody was asking in planet Debian, about Haskell vertical code alignment... well, again, perltidy has an option to enable/disable that.

I've developed many years without using it... recently I discovered it in first person, now I cannot live without it :) has options even for vertical alignment of indented comments.

I enjoy seeing it in action, after an hour or two of coding $anything. It finds always more inconsistencies than I did expect. And I really _try_ to be consistent.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#84
post #79

Earlier quoted context omitted.

Fact? My team is using Atom, VS code, IntelliJ and vim-go for Go. There has never been a problem with tabs vs spaces. On save gofmt converts all spaces to tabs and when I open Go files in vim-go it converts them to spaces according to my settings. Same for all other editors, whether you like tabs or 7-space indent.

Pretty sure it was a joke...

Right. After reading so much Go hate I'm not sure who is serious anymore.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#86

I would like to know If they are people who have 'switched'(coded with spaces and then use tabs or revers)?

Back in the very early 90s, I went through my company's codebase and replaced the mixed indentation with tabs. This was purely to save a space (small company, limited disk space). I probably preferred tabs at the time. Some time in the late 90s, though, I started to prefer the predictab ility and granularity of spaces.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#87
post #83

Some perl projects carried by teams, use perltidy as pre-commit hook. It's not as cool as talk about newer languages, but it handles all you may need about code indenting and alignment. And about tabs and about spaces. Today somebody was asking in planet Debian, about Haskell vertical code alignment... well, again, perltidy has an option to enable/disable that. I've developed many years without using it... recently I…

Perltidy is truly amazing. I haven't seen anything that comes close in terms of power and configurability.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#88

I would like to know If they are people who have 'switched'(coded with spaces and then use tabs or revers)?

I have switched from tabs to spaces. I have always thought that tabs were the more straightforward representation- if we're in the spirit of separating presentation from semantics, we might as well use the character that means "indent this thing". But the majority of people think otherwise, and that's probably never going to change.

In unrelated news, I like the Dymaxion projection and think that tau makes more sense than pi, but every last one of my precious ships has sailed. tear

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#89

Earlier quoted context omitted.

Don't align. void my_function( int arg1, int arg2, int arg3, ... ) {

While I quite like that style, now you have to convince people to never align, before you can convince them to use tabs. I've not seen any large public code-bases uses this style, so it's hard to know how well it works in practice. Do you know of any major projects with a 'no alignment' requirement?

MediaWiki uses tabs for indentation and discourages alignment. https://www.mediawiki.org/wiki/Manual:Coding_conventions
Post reply on HN