Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> It really is dumb to be arguing over tabs vs spaces, after all.

In an in-house dialect of Haskell I used to work with, we solved this problem by just making tabs a syntax error. Never had any problems.

(I think tabs might be have been allowed inside strings.)



Arguably it would be a problem for a coworker that wanted to use tabs.

“We’ll just force everyone to do things one way” kind of ignores the point I was making. It shouldn’t be necessary for you to care how anyone else formats their code, same as you don’t care what font their code displays in or what text editor they use. It feels like a vestigial aspect of programming that we have to concern ourselves with it in 2024.


> Arguably it would be a problem for a coworker that wanted to use tabs.

Wasn't a problem in practice. Just like we never had any problems with anyone wanting to use eg Pascal or so.


100%, way this felt in practice at Google was I could have whatever I wanted in my IDE, and it'd be transformed upon check-in into the house style, which I don't need to care about

FWIW, just happy to have a chance to unload this thought finally: it had surprisingly little impact on code reviews, in that the "personal preference I need to enforce" just ascended abstraction levels.


Does the IDE transform the existing code in the repo back into your preferred style on the next checkout?


Maybe I cant remember right, but IIRC any IDE in use there (same ones as outside, there's nothing special) had a setting for tabs vs. spaces / indentation size

And yes, that doesn't help you if ex. your style is a blank line following every code line.

In practice, it works, I surmise because people are fine with someone else's code being in a different style, but they want to write in their style.


So I'm guessing you mean Mu, the dialect by Standard Chartered.


Yes, indeed. In it's circa 2014 incarnation, when I last worked there.

(I don't really know what happened to it since.)


Simple, elegant, and wrong.


Tabs are particularly useless in a language like Haskell, because we don't do a lot of block-indentation there, but we do a lot of alignment. And your code mixes alignment and indentation.

In a language like C your outermost layers of leading whitespace are always indentation, and then you might have some alignment inside.

But in Haskell you might want to align arguments to a function, but some of the arguments can have blocks inside of them.

Mixing up tabs and spaces is technically possible, but it's too much of a pain in practice to bother.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: