R-alpha: missing() bug

Thomas Lumley (thomas@biostat.washington.edu)
Tue, 10 Sep 1996 13:58:10 -0700 (PDT)


Date: Tue, 10 Sep 1996 13:58:10 -0700 (PDT)
From: Thomas Lumley <thomas@biostat.washington.edu>
To: r-testers@stat.math.ethz.ch
Subject: R-alpha: missing() bug
In-Reply-To: <Pine.SUN.3.91.960910103115.27995A-100000@chekov>


In 0.11 missing() does not work correctly in nested functions:
eg:

> a<-function (x) {
	missing(x)
}
> b<-function (x) a(x)

> a()
[1] TRUE
> b()
[1] FALSE

This is particularly a problem with methods, which don't usually check 
the arguments they pass down to NextMethod()

In util.c, is_missing appears to check the current frame to see if the 
symbol is R_NilValue.  If the argument has been passed down from another 
function where it was already missing, it will actually be a pointer to the 
previous call frame, not R_NilValue.  This could presumably be fixed by 
recursively checking the previous call frames until the actual argument 
is found.




thomas lumley       Penguin: the name is supposed to come from 
PhD student         the Welsh _pen_gwyn_ meaning "white head". 
Biostatistics       As penguins have black heads and do not live 
U. Washington       within 10000 miles of Wales it is difficult 
Seattle WA 98195    to see how this theory arose.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-