[Rcpp-devel] Armor, Shield and Shelter.

Smith, Dale (Norcross) Dale.Smith at Fiserv.com
Fri Oct 11 15:57:36 CEST 2013


I don't think I have any use for your proposed code at this time. However, I would like to say that reducing the number of macro calls is a worthy goal. My own attitude is "build it and they will use it".

Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Financial & Risk Management Solutions
Office: 678-375-5315

-----Original Message-----
From: rcpp-devel-bounces at r-forge.wu-wien.ac.at [mailto:rcpp-devel-bounces at r-forge.wu-wien.ac.at] On Behalf Of Romain Francois
Sent: Friday, October 11, 2013 7:42 AM
To: Dirk Eddelbuettel
Cc: Rcpp-devel at r-forge.wu-wien.ac.at
Subject: Re: [Rcpp-devel] Armor, Shield and Shelter.

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

Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org

More information about the Rcpp-devel mailing list