Skip to content

[Rcpp-devel] RFC: Rcpp modules vs. RefClass

2 messages · Hao Ye, Dirk Eddelbuettel

#
I think not at all, unless you can force the same memory location for a new
R session and everything it loads. This is documented in the Rcpp-modules
vignette -- I tried it anyway, and it crashed my R session. :)

Best,
--
Hao Ye
hye at ucsd.edu
On Tue, Nov 29, 2016 at 11:02 AM, Kevin Ushey <kevinushey at gmail.com> wrote:

            
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20161129/3e45d60b/attachment-0001.html>
#
On 29 November 2016 at 11:12, Hao Ye wrote:
|     (I guess one downside of Rcpp modules is the use of external pointers,
|     which implies they do not serialize / deserialize well?)
| 
| 
| I think not at all, unless you can force the same memory location for a new R
| session and everything it loads. This is documented in the Rcpp-modules
| vignette -- I tried it anyway, and it crashed my R session. :)

Right.

And as I recall it is not so much the use of XPtr but rather that it points
to some content in memory for which we don't have a serialization mechanism.

Now, if memory serves, the good folks of the Stan project did in fact build
something related in order to preserve compilation via inline (or a variant)
across sessions so it is not impossible.  But it hasn't been done here.

And the bigger point, as Kevin noted, is that Modules is not exactly under
active development.

Dirk