An incomplete list of complaints about real code

Posted on

level 1

I don’t like meaningful whitespace.

That’s what I used to think. However, a short time later I learned Haskell and I discovered that I just don’t like Python. Haskell is indentation-based syntax done right.

(That said, feel free to disagree. But if you’ve only seen meaningful whitespace in one language, it might just be that one language that irks you.)

level 1

This is fun. The last two almost seem to contradict each other. If you don’t like x[y] and someone makes an accessor function getx(y), it would have out of bounds exception goto error. There is probably more nuance to it. Found myself agreeing with a lot.

level 2

Not necessarily an exception; it could just crash the program.

I think there is a difference between using exceptions as a matter of course and using exceptions as a slightly fancier abort(). An out-of-bounds access indicates a bug in your logic, which is different from things outside of your control (such as “file not found” or “connection refused”).

(Also, getx(y) is spelled x.at(y) in C++. 🙂

level 1

I don’t like syntax errors and other time bombs that hide until runtime.

What language does that, apart from shell scripts? I thought pretty much every interpreter does a full parse first.

OK, some languages have interesting ideas about what constitutes a syntax error (looking at you, Python & JavaScript: “undeclared variable” should really be a compile-time diagnostic).

level 2

They can come from surprising places. In iOS programming (unless you don’t have existing customers yet and can use SwiftUI) if you use storyboards or xibs they bind at runtime and will crash your app if you’ve hooked up an outlet then deleted it in the code.

So the code can be in swift which is actually a really nice language where the compiler makes sure you do everything by the book and prevents these errors (unless you desperately work hard for that foot gun, like unsafe in rust) so it’s safe as houses but you can still very easily introduce a runtime crash