Skip to content

Instantly share code, notes, and snippets.

@jimhester
Last active November 14, 2020 19:56
Show Gist options
  • Save jimhester/e3b78aad6a904b187e29fd47e7749c09 to your computer and use it in GitHub Desktop.
Save jimhester/e3b78aad6a904b187e29fd47e7749c09 to your computer and use it in GitHub Desktop.

Q1. Are all the latest release versions of tidyverse and tidymodels packages already using cpp11?

All tidyverse packages that used Rcpp have been converted except for readxl and lubridate. We plan to finish converting the remainder of the packages in the next 6 months.

Q2. C++20 brings a lot of exciting features to the language, do you plan to also add a {cpp20} package too?

I agree! It is possible, but it would not be for at least 5 to 7 years from now, if ever. Compiler support and availablity often lags the language specifications significantly. However you can definitely use C++20 features with cpp11 in your package today if you like!

Q3. So writable:: is like not using const& in Rcpp?

It is like that except that writable:: also copies the data first, which Rcpp does not do. Not copying is what causes the reference semantics issues in Rcpp.

Q4. I am using armadillo and Eigen in some packages - does that work well with rcpp11?

cpp11 has not explicit support for armadillo and eigen, however Rcpp and RcppEigen classes should work interchangeably with cpp11 vector classes, since they are all backed by SEXP types under the hood.

Q5. How long did it take to develop cpp11 and what were the biggest challenges? This seems like a huge value add to the ecosystem.

Most of the development was in June and July 2020, being unable to travel due to COVID helped make them productive months :) The biggest challenges were getting the APIs correct while ensuring we maintained good performance.

Q6. I am using Rcpp with some cpp11 and even cpp14 functionalities. So this is about efficiency in compilation and memory?

No, the main goals are not efficiency in compilation and memory, that happens to be a side benefit from the simpler implementation. The main goals are the 4 things I talked about

  1. Ensuring correct function semantics
  2. Safety from memory leaks
  3. Protection from unicode encoding errors
  4. Comprehensive support for ALTREP vectors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment