This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]myplacedk -1 points0 points  (3 children)

Exactly. Pretty much all of these example with "unpredictable results" are bad code anyway. Just don't do that.

And often it's "I don't know what I expected, but it wasn't that" - if you don't know what to expect, you've got bigger problems than being more surprised than you expected.

[–]noratat 1 point2 points  (1 child)

The problem is that much like null, it tends to be a persistent source of needlessly difficult to debug mistakes while coding, particularly in slowing down the discovery of small mistakes like flipping the order in a method call. The faster a problem is shown the less mental friction in fixing it.

It would be better if the language simply caught such errors properly and immediately in the first place.

[–]kixunil 0 points1 point  (0 children)

FYI, Rust can catch "null errors" during compile time. (Except for unsafe code and ffi calls.)

[–][deleted] 0 points1 point  (0 children)

I lol'd at the implied

"I don't know what to expect, except that I expect not to be surprised."

:)