Skip to content
Prev 42155 / 63458 Next

Reference class finalize() fails with 'attempt to apply non-function'

On Thu, Dec 8, 2011 at 2:52 PM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
Here is a self-contained reproducible example that immediately and
consistently produces the error on R 2.14 and R-devel:

library(methods)
a = setRefClass("A",
  methods=list(finalize=function() options("finalized"=TRUE)))
b = setRefClass("B", contains="A")

while (TRUE) {
    options("finalized" = FALSE)
    b = setRefClass("B", contains="A")
    if (!getOption("finalized")) break
}

detach("package:methods")
gc()



Thanks!
Dan