[603] in java-interest

home help back first fref pref prev next nref lref last post

Re: null objects and the instanceof operator

daemon@ATHENA.MIT.EDU (Simon Spero)
Thu Jul 6 13:21:19 1995

Date: Wed, 5 Jul 1995 20:58:10 -0700 (PDT)
From: Simon Spero <ses@tipper.oit.unc.edu>
To: java-interest@java.Eng.Sun.COM

On Wed, 5 Jul 1995, Nathan J. Williams wrote:

> 	For consistency, null needs to either be an instance of every
> class or of no class. I would prefer that null be an instance of no
> class. It is, in a sense, the language's only "non-object". More
> importantly, when the test:
> 	(a instanceof classB)
> 

AS far as I can determine, java classes are all lifted domains, where 
the object null is considered to be \bottom. If this were not the case, 
then it would impossible to assign null to a variable of type <classB>. 
Having (null instanceof C) be false would make things much more 
complicated. 

Since java has exceptions, it's much cleaner to either test for null, or 
just perform the dereference and catch the exception.

Simon

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post