Richard Cotton
2012-Mar-07 14:52 UTC
[Rd] .Internal(inspect(x)) gives overly verbose output for reference classes
Even for an extremely simple instance of a reference class x <- setRefClass("x") y <- x$new() calling the internal inspect function .Internal(inspect(y)) produces enough output that it takes several minutes to print to the console.? (Actually I gave up and terminated the command after ~10 mins.? It isn't clear whether the output would eventually complete.) Are reference classes really so complicated inside, or is this a bug?
Duncan Murdoch
2012-Mar-07 15:37 UTC
[Rd] .Internal(inspect(x)) gives overly verbose output for reference classes
On 12-03-07 9:52 AM, Richard Cotton wrote:> Even for an extremely simple instance of a reference class > > x<- setRefClass("x") > y<- x$new() > > calling the internal inspect function > > .Internal(inspect(y)) > > produces enough output that it takes several minutes to print to the > console. (Actually I gave up and terminated the command after ~10 > mins. It isn't clear whether the output would eventually complete.) > > Are reference classes really so complicated inside, or is this a bug? > > ______________________________________________If you look at the output, you'll see it's looping. When I hit Esc, I saw that .self is an S4SXP with an attribute .xData which is an environment containing the same .self, ad infinitum. So I'd say it's a bug in inspect(). It can handle the case of an environment holding itself, but I think it was written before S4SXPs contained themselves, and it looks like it's not checking for that. I'll take a look if someone else doesn't get there first... Duncan Murdoch