R-alpha: For exists(..) , I'd also like "inherits = TRUE" to be the default

Martin Maechler (maechler@stat.math.ethz.ch)
Fri, 6 Dec 96 12:06:31 +0100


Date: Fri, 6 Dec 96 12:06:31 +0100
Message-Id: <9612061106.AA10670@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: For exists(..) , I'd also like    "inherits = TRUE"  to be the default

(see Subject:)
Someone else (Paul Gilbert?) recently made the same request ...

My reasons for it :
	1) Intuition of statements like 
		if(exists("foo", mode='function')) {....}
	2) Compatibility with S

	3) You will save typing :
		  [this is half-jokingly, but really showing something ]
	   Mostly 'inherits = TRUE' is used :

% pwd
/usr/local/R-alpha/src/library  #------- 0.14 ------

% grep -n exists */funs/*
	
base/funs/exists:1:exists <- function(x, where=NULL, envir=NULL, frame=NULL, mode="any", inherits=FALSE) {
base/funs/exists:6:	.Internal(exists(x,envir,mode,inherits))
base/funs/fix:7:	if(exists(subx,inherits=T))
base/funs/library:3:	if (!exists(".Libraries", inherits=TRUE))
base/funs/library:25:	if (!exists(".Dyn.libs", inherits=TRUE))
base/funs/models:153:	if (!(missing(subset) || exists(as.character(match.call()$subset)))) 
base/funs/nextmethod:24: while (!(flag <- exists(cname, env, inherits = T)) && 
base/funs/nextmethod:68: while (!(flag <- exists(newmethod, env, inherits = T)) && which > 1) {
base/funs/unix.time:8:  if(!exists("proc.time", mode = "function", inherits=T))

------
So, there is only one occasion where NOT 'inherits = TRUE' is used :
in 'base/funs/models' ...

--- Martin
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-