11 ms·
Indeed, column alignment is just about the only reason to prefer spaces for indentation. If you use column alignment, then indenting with spaces avoids the ques
by Stratoscope 10y ago
Indeed, column alignment is just about the only reason to prefer spaces for indentation. If you use column alignment, then indenting with spaces avoids the question of "tabs for indentation, spaces for alignment."
But I'm with you: that kind of column alignment is harmful to maintainability, and I find it much less readable too.
Some time ago I posted a few examples of column alignment gone bad, from the Servo source code:
https://news.ycombinator.com/item?id=9469713 https://news.ycombinator.com/item?id=9469713
and also discussed alignment here:
https://news.ycombinator.com/item?id=9469713 https://news.ycombinator.com/item?id=9469713
Once you give up column alignment, there's no longer any real reason to prefer spaces, and you can gain the benefits of using tabs. As a side benefit, when you give up alignment, your code becomes just as readable in a proportional font as a monospaced font.
More details in my previous comments linked above, so I won't rehash them here. :-)
- scrollaway 10y agoHah, those are beautiful examples, thank you! :) The latest I encountered was a few days ago in the allauth codebase, where I found several instances of things like these: https://github.com/pennersr/django-allauth/blob/07d70fd68c4cb87b8eb4770952a029d8c72db392/allauth/account/views.py#L621-L624 https://github.com/pennersr/django-allauth/blob/07d70fd68c4c... I remember that page, actually. It's a really good point that code alignment breaks proportional fonts, I never considered it. More points for accessibility I suppose!