Hacker News new | ask | show | jobs
by derriz 363 days ago
Absolutely no counting is required at all so I think your joke falls a little flat.

Our visual system has the ability to detect implied straight lines (and other simple geometric outlines) from very small clues.

Therefore "seeing" the vertical lines implied by the indentation is effortless - so it's immediately obvious which elements belong to each other.

Indentation is an incredibly valuable "brain" hack that manages to instantly communicate hierarchy, not something to be sneered at.

We have no such innate ability to match parenthesis - determining hierarchy in a jumble of open and close parenthesis requires precise counting or, typically these days, tool/editor/IDE support.

2 comments

I also don't know why this is treated as controversial either: the first thing every project does is declare a canonical code formatting aka whitespace layout and start rejecting patches which don't follow it.
> Absolutely no counting is required at all so I think your joke falls a little flat.

Really? How do you see the difference between "TAB" and "SPACE SPACE TAB"?

The solution to that is easy: do not use tabs.
That is not the approach taken by any system that I know of that uses semantic whitespace. Tabs are meaningful in Python and make, and in fact required in make.
Haskell and Nim are both indentation-sensitive languages that only allow spaces as indentation.
That’s a design flaw of ASCII inherited by UNICODE not an argument against using indentation to portray hierarchy. I’m sure there are alternative UNICODE characters which render almost indistinguishable from “(“ also.