[Rcpp-devel] Fwd: Re: Making objects in the C++ "side" persistent

Martin Jakt mjakt at z2.keio.jp
Tue Jun 17 09:36:54 CEST 2014

Hi Dirk,

> Actually opening, reading, writing, closing, ... a file on the serialized
> data should now be possible with standard library facilities.  The
> combination is what I suggested, and it should allow us to duplicate what
> saveRDS / readRDS do.
> Ok?

At the moment I'm not so worried about saving / recreating the object; but I 
don't want to crash a user's R-session. These particular objects are fairly 
trivial to recreate and I used RcppModule mainly because I was familiar with 
it from a different package I wrote that does need to keep pointers to external 
objects. I also really like the semantics that RcppModule provides.

But the readRDS/saveRDS sounds useful for the future.
> | What I'd like is simply to have the object$function() first check the
> | value of .xData$pointer, to make sure it is not null before proceeding.
> | But can't really get any further without understanding what Rcpp Module
> | is doing.
> Like many of the internals, it is mostly undocumented.  Romain wrote most of
> it, but later decided to walk away from it.

hmm, I think I'm going to need to spend some time studying the R internals and 
probably template meta programming as well. In the meanwhile I will probably 
rewrite my package by wrapping .Call() directly. It's not too onerous as there 
are not so many functions to wrap.

one last question:

Is there a way to test if an external pointer is null (or rather <nil>). 
is.null() always gives me FALSE, and I can't find anything else.



Martin Jakt
Department of Systems Medicine
Mitsunada Sakaguchi Laboratory
Keio University School of Medicine

More information about the Rcpp-devel mailing list