[Rcpp-devel] Armor, Shield and Shelter.

Romain Francois romain at r-enthusiasts.com
Fri Oct 11 13:42:00 CEST 2013


Le 11/10/13 13:26, Dirk Eddelbuettel a écrit :
>
> Romain,
>
> On 11 October 2013 at 13:03, Romain Francois wrote:
> | Anyway, I'd like to propose adding Shield, Armor and Shleter to Rcpp.
>
> Sure.
>
> | This is a non disruptive proposal as the template classes I propose
> | don't interract with the rest of the code. We might not use them in
> | Rcpp, but we should. There are currently 155 calls to UNPROTECT in the
> | .h and .cpp of Rcpp. That is that many macro calls we could get rid of.
>
> (UN)PROTECT calls in code internal to Rcpp are less of a worry (at least on
> the user list);

Sure. I'll make my case in the appropriate channel if we decide to add 
the feature.

> another question is how often Rcpp users need to resort to
> this in their code, and how often it would help?  I don't have a good idea.

They fit perfectly in what I do with dplyrRcpp. This replaces the usual 
reflex of "I can't use an api class so i'll just use PROTECT/UNPROTECT"

We can get an idea using some grepping for UNPROTECT in packages that 
depend on Rcpp.

> And OTOH as this seems to non-disruptive and orthogonal to existing code, why
> not?

It is. That would just be 3 template class, all using inline functions. 
The code produced by the compiler should be equivalent to using 
PROTECT/UNPROTECT ...

The code written by the developper will be nicer.

> And the names are very cute indeed. I'd say go for it.
>
> Thanks,  Dirk

Kudos to http://thesaurus.com/browse/protector

I still want to see comments from users.

One thing I'm not certain about is the interface of Shelter, We might be 
able to make something more natural.

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30



More information about the Rcpp-devel mailing list