[Rcpp-devel] today's commits

Romain François francoisromain at free.fr
Sun Jan 3 18:36:48 CET 2010


Just to summarize todays commits:

- new Symbol class to wrap symbols (SYMSXP)

Symbol( "rnorm" ) instead of Rf_install("rnorm")

- new Language class to wrap language (LANGSXP)

Language( "rnorm", 1, 2.0, 3.0 )

makes an object that wraps something liks this :

 > call( "rnorm", 1L, 2.0, 3.0 )

- new variadic template pairlist to generate a pairlist from an 
arbitrary number of wrappable objects, this is used in the Language 
class but may also be used to generate pairlists (LISTSXP)

pairlist( 1, 2, std::string("foo"), true )

- new template grow : takes something that can be wrapped and use it as 
the head of the pairlist (append the wrapped object to the second 
argument). This is used in pairlist.

- new class Named that can be used to emulate named arguments in calls 
(or pairlists):

Language( "rnorm", 1, Named("mean", 2.0) , 3.0 )

will make this :

 > call( "rnorm", 1L, mean = 2.0, 3.0 )

- wrap is now a template. the default returns NULL and issue a warning, 
the specific implementations are as before.

- new template as, to ease conversions of SEXP into C++ types int, 
double, vector<string>, ... the code comes from RObject.asFoo() methods. 
so we can write things like this :

vector<double> y = as< vector<double> >(x) ;

where x is a SEXP (can also be an RObject through the magic operator SEXP()

- the garbage collection is now automatic and hidden, thanks to the many 
insights from the R-devel heroes yesterday.

- the RObject interface is now more complete, with copy constructors and 
assignment operators (taking SEXP or RObject)

I think that's it. see the changelog othewise.


Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
|- http://tr.im/IW9B : C++ exceptions at the R level
|- http://tr.im/IlMh : CPP package: exposing C++ objects
`- http://tr.im/HlX9 : new package : bibtex

More information about the Rcpp-devel mailing list