Le 17 juil. 2013 à 13:41, JJ Allaire <jj.alla...@gmail.com> a écrit :

>> dispatching could also happen in attributes. Why not having something like 
>> this:
>> 
>> // [[Rcpp::export]]
>> void foo( NumericVector x) {
>>     // do some stuff
>> }
>> 
>> // [[Rcpp::export]]
>> void foo( IntegerVector x) {
>>     // do some other stuff
>> }
>> 
>> This would involve some work in the way attributes work. But I can defintely 
>> see the value of this. Comments. JJ ?
> 
> Yes, agreed, this would be really cool! I don't think it's in principle 
> difficult to do.

Same here. I'm sort of off the grid for a few days now, resting from about 
3weeks of travelling. 

I'll have a look later then. 

Another extension i had in mind, well i think hadley mentionned it in Lyon was 
the ability somehow to export templates. 

template <int RTYPE>
Vector<RTYPE> foo( Vector<RTYPE> x){
    // do stuff
}

At the moment, if we have a function like this, we have to write the dispatcher 
sort of manually with a switch(TYPEOF)) construct. 

The issue then i guess is to find the right way to express which instantiations 
of the template we export, maybe something like : 

// [[Rcpp::exportTemplate(INTSXP,REALSXP)]]


But maybe it is not worth the trouble. Maybe this is simply a documentation 
issue on hiw to dispatch. 

Romain
_______________________________________________
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

Reply via email to