3 ms·
Thanks for the response. Well, the thing is, that you shouldn't have to fear for null to creep up somewhere in the code at any time. Sure, if your language (li
by whateverer 16y ago
Thanks for the response.
Well, the thing is, that you shouldn't have to fear for null to creep up somewhere in the code at any time. Sure, if your language (like most, sadly) has null as an alternate value for almost any type you'll have to do that, just like in C you have to check for the bounds of the buffers into which you read strings, but that doesn't have to be the case!
There are languages that made away with null in general, such as Haskell (yes, I know, I know), where if you have operations that require some null-equivalent, you declare it so by using the Maybe monad, and the compiler will ensure that the null gnomes won't throw a wrench at the rest of your code :)
On not trusting the output of other layers/code: it's a great policy, but I do think that we should strive to be able to take more and more things for granted in our code, or at least reasonably for granted, like we usually trust that random bits won't change in our integers because of cosmic rays. And for that the language designers can give us tools in some form or another, if they do their homework. It will only make it easier to live with our limitations.