Skip to content
Prev 3099 / 10988 Next

[Rcpp-devel] can one modify array in R memory from C++ without copying it?

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

Thread (18 messages)

Christian Gunning can one modify array in R memory from C++ without copying it? Nov 1 andre zege can one modify array in R memory from C++ without copying it? Nov 1 Christian Gunning can one modify array in R memory from C++ without copying it? Nov 2 andre zege can one modify array in R memory from C++ without copying it? Nov 3 Darren Cook can one modify array in R memory from C++ without copying it? Nov 3 Darren Cook can one modify array in R memory from C++ without copying it? Nov 4 Romain Francois can one modify array in R memory from C++ without copying it? Nov 4 Darren Cook can one modify array in R memory from C++ without copying it? Nov 4 Dirk Eddelbuettel can one modify array in R memory from C++ without copying it? Nov 4 andre zege can one modify array in R memory from C++ without copying it? Nov 4 Dirk Eddelbuettel can one modify array in R memory from C++ without copying it? Nov 4 Steve Lianoglou can one modify array in R memory from C++ without copying it? Nov 4 Dirk Eddelbuettel can one modify array in R memory from C++ without copying it? Nov 4 Steve Lianoglou can one modify array in R memory from C++ without copying it? Nov 4 Douglas Bates can one modify array in R memory from C++ without copying it? Nov 4 Darren Cook can one modify array in R memory from C++ without copying it? Nov 6 Dirk Eddelbuettel can one modify array in R memory from C++ without copying it? Nov 6 Davor Cubranic can one modify array in R memory from C++ without copying it? Nov 6