3 ms·
Reading this, I was visualizing in my head an article titled Why Nulls Are Good which started with "Look, you may not like the idea of values that may or may no
by pie_flavor 6y ago
Reading this, I was visualizing in my head an article titled Why Nulls Are Good which started with "Look, you may not like the idea of values that may or may not be present, but the truth is that a lot of programming relies on it. Why imagine..." and going on and on about optional values and never once addressing the real accusation about null, which is that it's a stupid way of accomplishing optional values.
Go's error handling is atrocious. Not because errors are return types, or because of boilerplate for propagating them. Because they do not communicate the most important invariant: that either there is an error or there is a successful value. A tagged union is better. Exceptions are better. Even C's error code system in a twisted way can be thought of as slightly better because at least there is one dedicated spot for the error so you can shove the function call in the if statement directly.
Not to mention, as an attack against exceptions, he writes code that logs errors to the console and does nothing else, and then complains that it logs errors to the console and does nothing else, as though that's a flaw in the exception system and not in the code he just wrote. No shit, if you write Java code to dump an unreadable stack trace, an unreadable stack trace is what's getting dumped. How this eludes the author, or why he thinks it's a benefit to not have a stack trace when you want one, is beyond me.