Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork219
Modules vignette review#982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Modules vignette review#982
Uh oh!
There was an error while loading.Please reload this page.
Conversation
riccardoporreca commentedJul 25, 2019
More on the issue with the The following is a minimal example #include<Rcpp.h>typedef std::vector<double> vec;// Free function wrappers to work around errors// error: call of overloaded// ‘method(const char [7], <unresolved overloaded function type>)’ is ambiguousvoidvec_resize (vec* obj,int n) { obj->resize(n);}// error: no matching function for call to// ‘Rcpp::class_<std::vector<double> >::method(const char [10], <unresolved overloaded function type>)’voidvec_push_back (vec* obj,double value) { obj->push_back(value);}RCPP_MODULE(mod_vec) {usingnamespaceRcpp; class_<vec>("vec") .constructor<int>()// exposing member functions .method("resize", &vec::resize)// .method("resize", &vec_resize) .method("push_back", &vec::push_back)// .method("push_back", &vec_push_back) ;} With compilation errors (Ubuntu 18.04, compiler details: voidpush_back (const value_type& val);voidpush_back (value_type&& val);voidresize (size_type n);voidresize (size_type n,const value_type& val); This does not seem to be supported by |
eddelbuettel commentedJul 25, 2019
Lovely stuff. I will make some time to review. Trying to get some other things out the door first so may take a few days. But first off ... big thanks for this! |
coatless left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is great. I made a few remarks for when@eddelbuettel looks over it.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| into the package namespace: | ||
| ```{r} | ||
| loadModule("yada", TRUE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Perhaps switch this to a namespace function call?
| loadModule("yada", TRUE) | |
| Rcpp::loadModule("yada", TRUE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is surely a valid point, although this approach does not seem to be used across other Rcpp vignettes.
Uh oh!
There was an error while loading.Please reload this page.
vignettes/Rcpp-modules.Rmd Outdated
| ``` | ||
| ```{r, eval=FALSE} | ||
| ```{r} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I feel like there was also a need to add:
import(methods)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I double-checked using the package produced byRcpp::Rcpp.package.skeleton(), removed the DESCRIPTION and NAMESPACE imports ofmethods and things seem to still work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for checking that. I will merge this PR but that whole aspect may be worth looking into in another ticket. This changed over the years, and maybe describing just one simple (working) setup is best.
Uh oh!
There was an error while loading.Please reload this page.
riccardoporreca commentedJul 26, 2019
@eddelbuettel,@coatless, I was happy to provide my small contribution after being a happy user for quite some time. |
eddelbuettel commentedJul 28, 2019
This is really good work, and I like it a lot. I didn't get torunning it though. I think we should work out what we want the sections / questions you labeled as 'CHECK-PR' to say before we merge. |
eddelbuettel commentedAug 3, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I truly apologize for taking so long. Life gets in the way at times. My verdict is mostly two thumbs way up. I would just ask for one more pass, removing all the CHECK-PR as detailed below. I may still have overlooked some issues, but my quick notes are below. PS We also moved Comments:
|
* As a preliminary step before reviewing the specific section about packges.* General refinement to make it easier for a user to follow and run the examples.* Now all inline examples assume fxx (clearly stated) and explicitly call Module(), to make the examples closer to self-contained.* Also fixed minor typos.
* World was not already included in the examples above.
* Inline examples with R code now have a non-included chunk creating the assumed relevant fx object based on the C++ code in previous named chunk(s).* The document has gained a parameter `eval` in the YAML header, that can be set to TRUE to optionally run the examples.* This revealed compilation errors with the std::vector example, fixed with a workaround, to be discussed upon PR.
* Focus on recommended usage via loadModule with example * General review, also covering exports.* New section about using the convenient sourceCpp.
* \proglang all the way.* \textsl{Rcpp modules} everywhere but in their own section.* Consistent usage of inline C++ elements.* Make evaluation even less intrusive.
* Removed parameters for evaluating chunks, restored evaluation as before, keeping named Rcpp chunks.* Finalized comment about resize and push_back workarounds for C++11.* Referred to Rcpp attributes vignette for sourceCpp.* Removed mustStart=TRUE (undocumented), the example works without.* Removed left-over style option chunks not needed.
7d3fb4f to9832314Comparericcardoporreca commentedAug 5, 2019
@eddelbuettel,@coatless, thanks for your feedback. Back to connected life after a long weekend, I have addressed the CHECK-PR points in9832314 as suggested above, with details in the commit comment. I have rebased the branch, although squash-merging might actually be a good idea. |
coatless left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM!
Review of the Rcpp-modules vignette, with major focus on the usage in packages, as a follow-up of#976 (comment)
A (not so short) summary of the changes:
Replaced sparse references to packages across a few existing examples in theRpp Modules section with a pointer to the specific section at beginning.
Introduced a new sub-section about usaging
sourceCpp()as an alternative tocxxfuntion()+getDynLib().Package section reviewed with focus on recommended loading via
loadModule()Improvements and harmomization of existing examples in sectionRcpp Modules
fx(clearly stated) and explicitly callModule(), to make them close to self-contained.Worldclass module in S4 dispatch example for completeness.fxobject based on the C++ code in previous named chunk(s).evalandresultsin the YAML header to control evaluating the examples on demand (e.g.Knit with parameters...).std::vectorexample, which I fixed with aworkaround to be discussed.Fixed a few tyops + batch cosmetic alignment:
\proglangall the way.\textsl{Rcpp modules}everywhere but in their own section.I left a few explicit comments marked as
CHECK-PRto have some pointers for the PR discussion.