4 ms·
indents per line of more than 2 spaces. drives me baddy I hate 2-space indentation. It's weird. It makes the code look less readable and every other more or le
by old-gregg 17y ago
indents per line of more than 2 spaces. drives me baddy
I hate 2-space indentation. It's weird. It makes the code look less readable and every other more or less popular programming language uses 4. I see no reason why Ruby code needs to look like a narrow, dense spaghetti because of this stupid "rule".
There is nothing in the language that justifies this awkward feature: Ruby isn't excessively nested and an average line length is short.
This language looks beautiful when properly indented with 4 spaces. I've heard from a couple of Pythonista friends that Ruby looked to much Perl-like to them, I suspect some of it can be attributed to this tradition of fucked up indentation.
Before reading open source Ruby code I always reformat it properly: just a hotkey in vim.
- jeroen 17y agoThe whole 2/4/8 spaces argument should be a reason to go for tabs. Then everyone could set their own tab size and have their code indented as they want. Unfortunately, I don't think all editors play nice.
- bkudria 17y agoAmen. And, don't inflict pain on others just because your editor sucks.
- ruby_roo 17y agoIt was weird for me at first, but I find it comfortable now. The eyes don't have to move as much while scanning code; small thing, I guess. Of course, if I didn't have a proper text editor that took care of the tab stops for me, it'd probably make me crazy to have to hit the space bar twice for indents. Still, it was never as off-putting as the significant whitespace in Python, which any pythonista can tell you becomes very easy to live with after an easy and brief acclimation period.