Readability? It is crucial for indicating which code belongs to specific blocks to help the compiler/interpreter and humans alike. There are primarily two methods for structuring code to achieve this: rigid indentation rules, as seen in Python, or the use of brackets. Elixir and Ruby use end blocks, which essentially serve as a substitute for curly braces.
Similarly, when considering JSON versus YAML or TOML for human readability, the same principles apply. Personally, I find indented code more readable, but this can be easily attained in most languages with universal code formatting rules and intelligent code editors that highlight different elements to improve readability.
It’s crazy that we have totally opposite views here.
I find code block which are delineated by brackets so much more readable than ones delineated by invisible characters. Especially at a glance
I don’t love do..end either, but still prefer them to arguing with Python about the level of indenting not being correct or that spaces were used somewhere somehow.
> this can be easily attained in most languages with universal code formatting rules and intelligent code editors that highlight different elements to improve readability.
Ofc, none of this is a practical issue, but that’s what makes it a fun topic of discussion ;)
Why not both? Approximately no one uses braces without indentation, and that's trivially enforceable with a code formatter. But I personally find that the redundant signal of the braces makes things much more readable than in the languages that lack that redundancy!
Every human communication mechanism includes deliberate redundancy to ensure that the meaning gets through even in suboptimal situations. Programming languages are somewhat unique in having a strong movement towards eliminating all redundancy.
Similarly, when considering JSON versus YAML or TOML for human readability, the same principles apply. Personally, I find indented code more readable, but this can be easily attained in most languages with universal code formatting rules and intelligent code editors that highlight different elements to improve readability.