Re: So what's null then if it's not nothing?

From: vc <boston103_at_hotmail.com>
Date: 19 Dec 2005 08:27:03 -0800
Message-ID: <1135009623.261858.9330_at_g49g2000cwa.googlegroups.com>


Jon Heggland wrote:
> In article <1134998757.235632.273440_at_z14g2000cwz.googlegroups.com>,
> boston103_at_hotmail.com says...
> >
> > So what happens when you have an expression TRUE OR X and X happens to
> > be NULL ?
> > Or something like (age < 30) or (occupation = 'student') where
> > occupation happens to be NULL ? Would an exception be thrown, or would
> > the entire expression evaluate to NULL ?
>
> Yes. :) The exception being that the entire expression is considered
> null.

So is it your assertion that 2 + X evaluates to NULL if X happens to be NULL ? If so, what is '+' then ? It's completely irrelevant whether or not one interprets such outcome as an exception (a perfectly normal integer can also mean an error).

>
> > Admittedly, it is easier if null
> > > propagates even in the face of "FALSE AND X" and "TRUE OR X". Which, by
> > > the way, there is precedent for in several programming languages: In
> > > Java, "true | booleanMethod()" does not necessarily evaluate to true.
> >
> > For example ?
>
> If booleanMethod() throws an exception.

One can give at least two possible answers to that:

o In an imperative language, one thinks in terms of execution flow control. Therefore, true || booleanMethod() cannot be interpreted as a mathematical expression and your example is irrelevant. The outcome of such instructions is rather a side effect of an algorithm stomping on various memory locations.

o In an imperative language, one can emulate declarative behaviour by insisting that a function always returns a result. In which case, ' true || booleanMethod()' will always evaluate to true as expected.

Sort of obvious, no ?

> --
> Jon
Received on Mon Dec 19 2005 - 17:27:03 CET

Original text of this message