[Rcpp-devel] How to modifying the elements of a list in the global environment?
Christian Gunning
xian at unm.edu
Fri Oct 19 10:19:01 CEST 2012
> Giovanni,
>
> Anything you pass from R into your C++ routine should be considered
> read-only. It's typically a bad idea to do in-place updates of the R
> object you passed in as an argument.
Really? I was under the impression that the ability of in-place
modification was a conscious design decision.
Be aware that you've stepped outside of the functional programming
paradigm, yes.
But read-only? From the C++ point of view, it's just memory.
That said, if you want safety (e.g. default R behaviour), use clone().
Then you can modify to your heart's content.
-Christian
--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
More information about the Rcpp-devel
mailing list