From thomas@biostat.washington.edu  Fri Sep 15 16:42:44 2000
From: thomas@biostat.washington.edu (Thomas Lumley)
Date: Fri, 15 Sep 2000 08:42:44 -0700 (PDT)
Subject: [Rd] NULL == NULL
In-Reply-To: <14786.5812.611071.633622@gargle.gargle.HOWL>
Message-ID: <Pine.GSO.4.21.0009150835420.26164-100000@atlas.biostat.washington.edu>

On Fri, 15 Sep 2000, Martin Maechler wrote:

> gives an error in R.
> 
> In both S+3 and S+5, it "works" by returning NULL or logical(0),
> respectively.
> 
> As a consequence,
> 
>    all(x == y)
> 
> returns TRUE in Splus, when x <- y <- NULL
> but gives an error in R.
> 
> Do we have a good reason *not* to return  logical(0) ?

I think returning logical(0) is a good idea. Having all(NULL==NULL) be
TRUE is consistent with what we do for vacuous cases of min and max. 

However, a arguable reason for not doing it is that NULL is actually a
list with no elements rather than a vector with no elements, and you can't
compare lists with ==. On the gripping hand, you can't turn NULL into a
vector of length zero using eg unlist(), so the only way to get this
comparison to work is to have NULL==NULL.

	-thomas



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] NULL == NULL
Thomas Lumley