couldn't find function "print.tframe"

Thomas Lumley Thomas Lumley <>
Sat, 16 May 1998 12:39:40 -0700 (PDT)

Ok. The print.tframe problem appears to be as follows:

When printList has a list element that is an object it creates a call to
print() with the evaluated object and evaluates that call in the
environment R_NilValue (ie NULL).

If this object has class "foo" is called. If there is a 
NextMethod() in, do_nextmethod  reaches back to find
the environment that print() was called from and looks for the
definition of that applies there, in order to get the formal
arguments right.  This fails, since print() was 'called' from the NULL
environment, where is not defined.

You can reproduce this in interpreted code by
R> b<-1              
R> class(b)<-"foo" 
R> eval(expression(print(structure(1,class="foo"))),NULL)

The question is how to find the right environment to evaluate the call,
since printList doesn't know what environment print() was called from. 
R_GlobalEnv doesn't seem right, since may not be defined there. 

One solution would be to explicitly pass the environment down, but this
takes a lot of changes, some of them to functions called from outside
print.c.  I'm looking at this but would welcome a better solution.

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: