Re: Optional attributes

Date view Thread view Subject view Author view Attachment view

From: Laurence Tratt (
Date: Tue 18 May 2004 - 22:09:25 BST

On Tue, May 18, 2004 at 10:00:45PM +0200, Shane Sendall wrote:

Dear Shane,

> Certainly from a language definition point of view. 'null' as meaning the
> absence of a value is the most elegant, because IMO this is the real
> reason/meaning for 'null'.

One must be careful not to confuse the standard English meaning of a word
with the concept it represents in a given context. I have some sympathy for
the Python approach where they called the keyword None which gets rid of the
"ooo, null means there must be nothing there" problem.

My take on this is that it doesn't make sense to expose directly to the user
the concept of the absence of a value. In a pure OO system, if you have NULL
as a special object (or some means of uniquely identifying it), you can
achieve all that you can if NULL is implied by the absence of a value.

However, if NULL is present merely by its absence then what happens in e.g.
a statement like "print(NULL)" (or whatever)? Answer: the print function now
has to explicitly know about NULL, because it can't call a "toStr()" method
when there is no object present! Basically if you make NULL be the absence
of a value, you start having to encode knowledge of NULL into places that
could otherwise have remained blissfully ignorant of it. It's a very non
object orientated decision which can end up merrily biting people on the
arse in perpetuity.



Date view Thread view Subject view Author view Attachment view