Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • No, I don't mean a null reference exception. In all the languages I know uninitialized but declared variables are some form of null. Commented May 23, 2011 at 22:57
  • But your question was not about uninitialized variables. And there are languages that do not use null for uninitialized variables, but instead use wrapper objects that can optionally contain a value -- Scala and Haskell, for example. Commented May 23, 2011 at 23:21
  • 1
    "...but instead use wrapper objects that can optionally contain a value." Which is clearly nothing like a nullable type. Commented May 24, 2011 at 0:05
  • 1
    In haskell there is no such thing as an uninitialized variable. You could potentially declare an IORef and seed it with None as an initial value but that's pretty much the analog of declaring a variable in some other language and leaving it uninitialized which brings with it all the same problems. Working in the purely functional core outside the IO monad haskell programmers have no recourse to reference types so there is no null reference problem. Commented May 24, 2011 at 0:37
  • 1
    If you have an exceptional "Missing" value, that is precisely the same as an exceptional "null" value - if you have the same tools available to handle it. That's a significant "if". You need extra complexity to handle that case either way. In Haskell, pattern matching and the type system provides a way to help manage that complexity. However, there are other tools for managing complexity in other languages. Exceptions are one such tool. Commented May 24, 2011 at 4:09