|
|
|
|
|
by chrislattner
1017 days ago
|
|
Hey, thanks for your interest. I think it's interesting that you think I don't care about things like whitespace vs braces? In the Lex interview I was kidding around, but I assure you, I do care. Braces are strictly worse than whitespace indentation for several reasons. Brace-based languages: 1) Generally have the "dangling else" set of ambiguities.
2) Some (e.g. C) allow but do not require braces which leads to style debates. The ones that require braces are more verbose.
3) Require more punctuation clutter, and consume more vertical whitespace in practice.
4) ... use braces that are completely redundant with indentation in practice! It's super funny to see people defend curly based languages. Using curlies but not indenting properly is almost always a sign of a bug (e.g. clang has warnings for this sort of thing due to the "goto fail" and other debacles. That said, as you also know, Python compat is not optional for us, so Mojo doesn't actually a choice at all here. I find it amusing though that your post acknowledges thoughtfulness in language design and thinks this is an example of a lapse of judgement. :P -Chris |
|
Well, that's because they're not really "strictly worse" in every way. I find curly braces helpful for readability and cursor navigation. The latter is only possible with Python by completely parsing the code. Also I don't like reading vertically dense code, so having (almost) empty lines inbetween is fine. All subjective of course, but that's the case for every aspect of language syntax.
> Using curlies but not indenting properly is almost always a sign of a bug
I don't think anyone criticising Python's syntax cares about the freedom to have inconsistent indentation, that's not the point.