xigoi

Braces Criticism

There are, in general, three common ways to delimit code blocks: braces, end-keywords and indentation. When we write pseudocode on paper, we tend to almost always use indentation — it provides an easy visual cue and takes the least effort to write. So why do so many programmers insist on using braces for this purpose, which make code much harder to visually parse? Here are some commonly given reasons with my responses:

Semicolons Criticism

A very popular feature in programming languages, especially those derived from C, is requiring a semicolon after every statement. Why is this necessary if you're already separating statements by newlines? It just adds one more character you need to type; and more importantly, a lot more characters that you have to visually process, but that don't contribute in any way to the logic of the code (the term for this is syntactic noise). There's a lot of languages that do completely fine without them: Python, Ruby, Lua, Nim, Go, Haskell, etc. And JavaScript shows that even in a language that uses semicolons, they can be inferred pretty well. Also note that Lua doesn't actually care about newlines, its syntax is made in a way that a statement always ends unambiguously.