14 ms·
Age of "var, val" is over. Now age of "significant whitespace". If seriously, seems like indent syntax is default to go nowadays. Python has way too big influen
by rmrfchik 4y ago
Age of "var, val" is over. Now age of "significant whitespace".
If seriously, seems like indent syntax is default to go nowadays. Python has way too big influence on language designers.
- jfecher 4y agoI'm not a fan of python (it handles significant whitespace somewhat poorly). Cases like mixed tab-space whitespace and single-line only lambdas are python-specific problems for example. I chose it mainly because I like the style and I haven't found it to be an issue in practice yet, especially with flexible rules for line continuations. The biggest detriment to me is the lack of auto-formatters for indentation. Edit: I'll add to this a point I haven't seen discussed before about functional languages using the `f a b` syntax specifically. Without significant whitespace you cannot really have semicolon ellision with this syntax since almost any line may be interpreted as a function application of the next line. E.g. `a = b + c` and `foo 32` as subsequent lines would be interpreted as `a = b + (c foo 32)`, hence why ocaml requires semicolons. For some people semicolons are fine, but they're just noise to me :) There's more detail on the specific significant whitespace scheme used on the website here: https://antelang.org/docs/language/#significant-whitespace https://antelang.org/docs/language/#significant-whitespace
- rmrfchik 4y agoYou claim, significant whitespace helps mitigate "goto fail" errors. As for me, indent syntax allows more human errors during refactoring. When moving code blocks around, you can easily misplace whitespaces and compiler/editor has no ability to help you.
- jfecher 4y agoThis is definitely an issue, but isn't one I run into often. Just like if I'm pasting code in rust I need to make sure it is inside or outside an if statement, I likewise need to ensure pasted code in ante is inside/outside the if statement by looking at its indentation relative to the previous line. The compiler can help somewhat here, just not a lot. If your indentation is not on an existing indentation level you will get an error since you cannot randomly start indent blocks in your code. I do think the biggest detractor of indentation-sensitive syntax in general is the loss of auto-formatting indentation though.
- strbean 4y agoRegarding single-line only lambdas, I think that isn't an intractable issue with the grammar. Guido van Rossum basically said parsing them is hard, and he doesn't like lambdas in the first place, so it won't happen. [0] Similar to "tail call optimization encourages dirty FP nerds" logic. Terrible decisions IMHO. [0]: https://www.artima.com/weblogs/viewpost.jsp?thread=147358 https://www.artima.com/weblogs/viewpost.jsp?thread=147358
- jfecher 4y agoAgreed. Other whitespace sensitive languages like Haskell, F#, and Ante handle multiline lambdas just fine
- PontifexMinimus 4y agoThat and Haskell.
- pjmlp 4y agoML languages did it first.