Wednesday, 25 May 2016

The Story of Null

No Unrelated to that rather dull novel/film called the Life of Pi.

The concept of nothing first came out of some brilliant philosopher.

Nothing is better decomposed to No Thing where Thing can be anything.

In many languages, the ultimate nothing is Null.  Dev/null,  null...

Null has nothing,  can do nothing.

In some systems of logic,  programming,  trying to do things with true null gives exception is not allowed, because any attribute of null is undefined and yields undefined results.

Likewise, a null pointer exception shows that it is not only an object that can be null.  References to an object can be null too. This mistake has led to many crashes.

Of course,  you can always be explicit about nothing, if you want nothing to mean the absence of that thing,  and you know what the absence of that thing means. This is called a null object pattern.

In others, the fact that something can be undefined is acknowledged and accepted, and a default behavior prescribed.

The ideal language would handle these problems gracefully and intelligently,  aware of the context in which they are used,  instead of just crashing

No comments: