The handiness comes at the expense of dumb mistakes not being detected at the earliest possible time, as close to the buggy line of code as possible.
I think the handiness of this particular feature would be occasional at best, whereas dumb mistakes happen all the time.
Certainly a SQL-like NULL would be bad for testing, which really banks on propositions being either true or false. Consider this code, from unittest.py:
class TestCase:
...
def failUnless(self, expr, msg=None):
"""Fail the test unless the expression is true."""
if not expr: raise self.failureException, msg
Now suppose I have a test that does this:
conn = connect(addr)
self.failUnless(conn.isOpen())
Suppose connect
erroneously returns null. If I'm using the "null pattern", or the language has it built-in, and conn
is null, then conn.isOpen()
is null, and not conn.isOpen()
is null too, so the assertion passes, even though the connection clearly is not open.
I tend to think NULL
is one of SQL's worst features. And the fact that null
silently passes for an object of any type in other languages is not much better. (Tony Hoare called null references “my billion-dollar mistake”.) We need less of that sort of thing, not more.