Hacker News new | ask | show | jobs
by Freebytes 1117 days ago
What would you suggest instead? Please do not say Python. Using spaces for syntax is madness.
1 comments

You never make use of horizontal spacing when, say, making notes on paper?
Notes on paper are for humans.

Programming languages are for humans and machines. Machines do better with braces. (I've written lexers for both.)

Also, try to write an automatic formatter for a whitespace-delimited language; if your indentation is wrong, your logic is wrong, whereas with a brace language, if your indentation is wrong, you run a formatter, and it's all golden.

A parser is something you write once and then it's done, so it shouldn't be the deciding factor. And parsing indentation-based languages is not that hard, just replace indents and dedents with a special token.

In a brace-based language, if your braces are wrong, your logic is wrong. How is that better? At least a mistake in indentation is much easier for a human to spot.

Run the formatter, and the brace-based mistake is easy to spot too.
So what's the point of having braces if you're going to use indentation anyway?
To do more things with the source than just compile it.