Hacker News new | ask | show | jobs
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

3 comments

> It's super funny to see people defend curly based languages.

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.

Chris,

Ha! I love your reply. Thank you.

I know you care about language design. As I said more or less, that's self-evident, and I'm sorry for taking your whitespace comments too literally. You're the source, after all, not me, so accept my apologies there. It's misinterpretation, but not meant to be a misrepresentation. :-)

My comment wasn't meant to be critical of you. Honestly, as a pretty famous engineer, it never even crossed my mind you might read my message. As I said, I know you have to deal with reality to accomplish your goal, and that reality existed before you showed up to take on the challenge.

Thank you for all your contributions and good luck on Mojo.

Chris

No worries at all, it's such a polarizing discussion point and always comes up. :)
Curly braces are very helpful during development, because you can scope code without having to reindent it. It's quite similar to being able to comment out a block of code, which Python happens to also make somewhat frustrating.