[Rcpp-devel] can one modify array in R memory from C++ without copying it?
Dirk Eddelbuettel
edd at debian.org
Fri Nov 4 15:39:38 CET 2011
On 4 November 2011 at 10:13, Steve Lianoglou wrote:
| On Fri, Nov 4, 2011 at 9:36 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
| > On 4 November 2011 at 16:56, Darren Cook wrote:
| > If you feel really strongly about you could consider a patch that makes this
| > non-R behaviour you suggest an option. To most of us who use Rcpp between R
| > and C++ it really is a feature.
| >
| > Don't get me wrong though: I like your input here and maybe the implicit
| > nature of things needs to be stressed even more.
|
| What if Rcpp fires a warning (I guess there's a C function that you
| can use to invoke R's `warning()`) in these scenarios?
Hah. I invite to modify your copy and to activate a little message in each
ctor. You will be amazed to see how many implicit conversions happen.
Plus this is templates for you. It is not that we have an implicit
// pseudo-code ... and a satire!
// do this to really mess with Darren's head
if (typeof(X)=="int") {
doMeanConversionToNumeric(x)
}
where we could neat insert
std::cout << "Steve suggested we tell you that something was converted"
| That'd alert you as to what happened and still let people who just use
| the CRAN-stalled Rcpp become aware of when this happens in their code.
Very nice in principle. A lot harder in practice.
What we all see here is a side effect of what is otherwise type and
conversion "magic". The "No Free Lunch" theorem still holds.
Dirk
| -steve
|
| --
| Steve Lianoglou
| Graduate Student: Computational Systems Biology
| | Memorial Sloan-Kettering Cancer Center
| | Weill Medical College of Cornell University
| Contact Info: http://cbio.mskcc.org/~lianos/contact
--
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx
More information about the Rcpp-devel
mailing list