Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autogeneration Warning for RcppExports.* #526

Closed
coatless opened this issue Aug 1, 2016 · 4 comments
Closed

Autogeneration Warning for RcppExports.* #526

coatless opened this issue Aug 1, 2016 · 4 comments

Comments

@coatless
Copy link
Contributor

coatless commented Aug 1, 2016

As shown in Rcpp function with no argument on StackOverflow, there may need to be some slight changes associated with:

  1. Code generation headers in RcppExports.cpp and RcppExports.R
  2. Documentation surrounding Rcpp.package.skeleton() and compileAttributes()

The current headers:

RcppExports.R

# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

RcppExports.cpp

// This file was generated by Rcpp::compileAttributes
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

The proposed new headers:

RcppExports.R

# Generated by using Rcpp::compileAttributes() - do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

RcppExports.cpp

// Generated by using Rcpp::compileAttributes() - do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

Mimics the descriptor used by roxygen2:

% Generated by roxygen2: do not edit by hand

Documentation Changes

Rcpp.package.skeleton()

Modify the details section to emphasize autocreation and not to modify by hand

Current:

If the attributes argument is TRUE, then rather than generate the example files as described above, a single rcpp_hello_world.cpp file is created in the src directory and it's attributes are compiled using the compileAttributes function, so files RcppExports.R and RcppExports.cpp are generated as well.

Proposed:

If the attributes argument is TRUE, then rather than generate the example files as described above, a single rcpp_hello_world.cpp file is created in the src directory and it's attributes are compiled using the compileAttributes function. This leads to the files RcppExports.R and RcppExports.cpp being generated. They are automatically regenerated from \emph{scratch} each time compileAttributes is called. Therefore, one should not modify by hand either RcppExports file.

compileAttributes

Current

For C++ functions adorned with the Rcpp::export attribute, the C++ and R source code required to bind to the function from R is generated and added (respectively) to src/RcppExports.cpp or R/RcppExports.R.

Proposed:

For C++ functions adorned with the Rcpp::export attribute, the C++ and R source code required to bind to the function from R is generated and added (respectively) to src/RcppExports.cpp or R/RcppExports.R. Both of these files are automatically generated from \emph{scratch} each time compiledAttributes is run.

Tagging as a part of #506

@eddelbuettel
Copy link
Member

Very good. One more, maybe, is to add a line to stdout when Rcpp.package.skeleton() is running / has finished. Need to check again where a good spot would be.

@coatless
Copy link
Contributor Author

coatless commented Aug 1, 2016

I'm thinking immediately after line 146?

@coatless
Copy link
Contributor Author

coatless commented Aug 2, 2016

@eddelbuettel

While making changes in Rcpp.package.skeleton(), I realized that the message() statements were not very descriptive of what files were actually being added. For example:

>> added example src file using Rcpp attributes

Line 144

How would you feel if these notations were replaced with something along the lines of:

>> Creating `rcpp_hello_world.cpp` from template containing Rcpp attributes

I dare say that the above format is influenced by devtools "feel" e.g.

> devtools::use_test("fake")
* Creating `tests/testthat/test-fake.R` from template.
* Modify `tests/testthat/test-fake.R`.

I'm tempted to make this a separate issue and address it later.

@eddelbuettel
Copy link
Member

I just tried to follow the flow and feel of the Base R functionality we were extended. I for would surely not be influenced by devtools :)

With that, the longer text may be ok, starting with a capital much less so to my eye.

eddelbuettel added a commit that referenced this issue Aug 3, 2016
Auto generation Warnings & Invalid C++ Identifiers (Closes #526 and #387)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants