couldn't find function "print.tframe"

Thomas Lumley
Sat, 16 May 1998 11:04:33 -0700 (PDT)

On Fri, 15 May 1998, Paul Gilbert wrote:

> I have an object with an attribute "tframe" for which there is a generic method
> print.tframe and also a method print.tframe.default defined in a library.
> However, when I use attributes(object) I get the message
> $tframe
> Error: couldn't find function "print.tframe"
> It's as if <primitive: attributes> is not looking through the search list?

It's more subtle than this.  If you  do
R> b<-1
R> class(b)<-"foo"
R><-function(x) { print("foo\n"); NextMethod()}

Then printing b works perfectly well

R> b
[1] 1
[1] "foo"

and the problem arises when you print a list containing b

R> list(b,1)
Error: couldn't find function ""

The error happens in the NextMethod() call of, at line 284 of
objects.c, where do_nextmethod tries to find the function that called it.

	/* set up the arglist */
	s=findFun(CAR(cptr->call), cptr->sysparent);

In the working case, cptr->sysparent is R_GlobalEnv, in the non-working
case it's R_NilValue (ie, NULL)

BTW, the gcc documentation says that if we used gcc -g3 in compiling,
some debuggers would be able to cope with macros like CAR() and TYPEOF().
Does anyone know if gcc is one of them?

Thomas Lumley
Biostatistics		: "Never attribute to malloc(3) what  :
Uni of Washington	:  can be adequately explained by     :
Box 357232		:  incompetence"                      :
Seattle WA 98195-7232	:				      :

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: