On 1 March 2012 at 10:00, Darren Cook wrote: | >> DottedPair derives from RObject, but adds, er, functions. (Which Rcpp | >> functionality is this adding? Why are these functions in their own class | >> and not in RObject?) | > | > DottedPair.cpp adds methods. And as far as I can see, everything in | > DottedPair.h is within the DottedPair class's curly braces. Which | > functions do you mean should be in RObject? | | Thanks for the reply Davor. It was a design question: why does | DottedPair [2] have its own class? It does not add any member variables | and it does not override any functions in its base class [1], so I | assume it exists solely for code clarity [3]. I wondered what concept is | was clarifying or representing.
At a first approximation, everything is done in a way that made sense with _given R representation_. Rcpp is not a green field project, it exists to get data back and forth between C++ and R. I have some vague memory of some of these things having pairlist objects behind them, and pairlist objects not being that beloved anymore in R land either. But compatibility matters... | Darren | | [1]: | https://r-forge.r-project.org/scm/viewvc.php/pkg/Rcpp/inst/include/Rcpp/RObject.h?view=markup&root=rcpp | | [2]: | https://r-forge.r-project.org/scm/viewvc.php/pkg/Rcpp/inst/include/Rcpp/DottedPair.h?view=markup&root=rcpp | | [3]: Another way of saying that is that it seems I could move all | DottedPair's functions into Robject, then write: | | class DottedPair: public Robject {} | | and everything should still compile and work. (Or I've misunderstood | something :-) Not to put too fine a point on it, but we have 700+ unit tests so that you could answer that question of yours by making that change yourself and running R CMD check. If it passes, fine. If not, well.... Dirk -- "Outside of a dog, a book is a man's best friend. Inside of a dog, it is too dark to read." -- Groucho Marx _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel