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

Christian Gunning xian at unm.edu
Wed Nov 30 12:15:01 CET 2016

On Mon, Nov 28, 2016 at 9:40 PM, Christian Gunning <xian at unm.edu> wrote:

> B) Are there any *gotchas* with using Rcpp "modify-in-place" functions
> inside RefClass methods?

After some reading, I'm going to answer my own question and point to one
possible *gotcha* that wasn't clear to me at first.

* From help("refClass-class"):
"In particular, methods should not use non-exported entries in the
package's namespace, because the methods may be inherited by a reference
class in another package."

* From vignette('Rcpp-attributes'):
"The compileAttributes function deals only with exporting C++ functions to
R . If you want the functions to additionally be publicly available from
your package’s namespace another step may be required."

So, the Rcpp helper functions used by refClass methods should be exported
from the package namespace to facilitate downstream inheritance, even if
the helper functions are not intended for public consumption.  Honestly,
this is unlikely to be an issue for average users.


A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20161130/bfca5e2d/attachment.html>

More information about the Rcpp-devel mailing list