upvote
We have studies since ages ago that consistency in code style is one of the most important requirements for code quality.

This goes down to the details like that you should either use spaces over tabs OR prescribe editor config such that the code looks similar on each machine.

Of course this doesn't automatically mean that code ligatures are harmful, but I would be quite wary of using them. At the very least it introduces some friction, not sure if the arguably lower mental load of using real mathematical symbols instead of the ASCII symbols makes up for it.

reply
I'v been coding now for like 15 years and I'm not old enought to understand the debate between spaces vs tabs :)

I guess my IDE choices never surface the issue for me... visually they just look the same. I cannot say which codebase uses spaces which uses tabs. I never even think about it. I just smash tab character and don't care that there have been spaces. Or enter or { and IDE does the indentation. I just choose not to press space 2-4-8-16 times in a row.

Now I hope I won't get bulldozed over by HN crowd...

reply
One of the main arguments for tabs over spaces was always that people wanted to configure how much space a level of indentation makes up on screen.

With tabs pretty much every editor except something like notepad.exe could do it since ancient times, with spaces the editor needs to do a bit more processing, so you were a bit more restricted in editor choice, if you really were bothered so much by the indents chosen in the project.

So it is actually quite similar to the ligature discussion. It would be good if the code looked the same for everybody but now instead of saying "But 8-space indents waste so much space on the screen :(" some people now go "But I don't like seeing things like != or -> instead of modern Unicode symbols :("

reply
Spaces vs. tabs causes a lot of issues for Python programmers who share their code with other programmers. The other place where spaces vs. tabs is an issue is with makefiles, probably one of the most annoying features of POSIX.
reply
I also remember old school bourne shell wanting tabs in some places (case statements?), but bash doesn't have that issue.

These days, I try avoid them outside of makefiles.

reply
Considering the way `/bin/sh` had a bunch of different implementations before POSIX standardization minimized that in the mid-1990s, I wouldn’t be surprised if one of those distinguished spaces from tabs.

That said, the original UNIX V7 implementation of /bin/sh didn’t distinguish different kinds of whitespace:

https://www.in-ulm.de/~mascheck/bourne/v7/

reply
Well, the tabs vs spaces had been mostly resolved and spaces won. But obviously it was never about what physical keys to press, nobody on the spaces side would spam the space bar to indent stuff (except maybe in the unfortunate situations of having to use an editor with no choice of setting the tabulator to emit spaces, or a textfield in a non-editor UI where the tabulator cycles the focus instead).
reply
I'm still in the "tabs for indentation, spaces for alignment" camp. If you adhere to it, it makes your code look nice on any tab size.
reply
[dead]
reply
Typing formulas in Excel

It's too bad spaces won, tabs is just correct I think, since one can configure the tabstop to use any indent size they would like. I'm quite tired of reading 2-space indent. Seems everything has moved this way now except python. I'm even seeing C with it, which is especially jarring. I think the languages that use braces for indentation particularly need 4. Python needs it least, and I can read Ruby because its blocks are delimited by words and it's bad style to write long methods

reply
deleted
reply
Agreed, four is optimal and has luckily been the standard in projects I’ve worked in. Encourages you to avoid deep nesting as well.
reply
I'm in the same boat, I always just press tab and let my IDE or text editor fill in with N spaces.

Granted, I'm also someone who heavily encourages the use of Black as the Python formatter in projects I'm on, specifically because it has no configurable options - can't have a holy war about formats if nothing can be changed.

reply
> "understand the debate between spaces vs tabs"

The reason spaces won is that it's not (spaces) vs (tabs), it's (spaces) vs (tabs AND spaces).

reply
Oh, for Pete’s sake. The bodies from this holy war are barely cool…
reply
When I program or I write maths I see and think of -> >>= <*> etc as a single, semantically meaningful symbols. Not only do I use a ligature for them, but I make my keyboard to use one single key. For the same reason I have a key emitting “forall” which Emacs then displays as ∀.
reply
They don't detract from readability for me, so it's just pretty symbols = me more happy
reply
[dead]
reply