News for hackers. Stuff that matters.
Re:Why we've banned null in our codebase by ajross on Friday January 04, 2013 @12:01PM (#5008493)
How is you description different from "emulating paradigms like RAII in environments that don't natively support them?". And it doesn't address things like the trivial list/cache case, where clearly you need a null(-equivalent object reference). Clearly the compiler isn't going to be able to enforce that all lists are infinitely long...

I'm not saying it's a bad trick. I'm saying that thinking of it as "banning null" is an incomplete understanding of the issue.

Re:Why we've banned null in our codebase by fusiongyro on Friday January 04, 2013 @12:08PM (#5008533)
I hate to say "you should," but you really should spend a few hours going through a Haskell tutorial. You'll be surprised how different things are.

The Haskell equivalent to this Scala Option fiasco is Maybe, which is defined as:

data Maybe a = Just a | Nothing

"Nothing" is not a null reference and "Just a" is not an object with a pointer to another object. "Just a" is a constructor with a single value parameter. "Nothing" is a constructor that takes no parameters. These are values, not references or values with references or references to references. "Nothing" always has a specific type (Maybe Integer, Maybe String, etc.) even though it has no auxiliary data of its own. This means "Nothing" can't show up anywhere you have values--it can only show up where you expect a value of type Maybe. Indeed, the whole point here is that you are forced to explicitly reckon with the possibility of null where it can happen, and you are freed from responsibility to worry about it everywhere else.

Haskell does just fine without the kind of null we're talking about, in a way that I suspect is fundamentally different from what you're intuiting.

Re:Why we've banned null in our codebase by mseebach on Friday January 04, 2013 @12:03PM (#5008508)
When you need a null, you use None.