Skip to content

Commit b58bf98

Browse files
committed
Merge pull request #470 from RcppCore/feature/deprecate-loadRcppModules
deprecating loadRcppModules (closes #469)
2 parents 52a8ad0 + 618f419 commit b58bf98

File tree

10 files changed

+68
-17
lines changed

10 files changed

+68
-17
lines changed

ChangeLog

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1-
2013-05-15 Kevin Ushey <[email protected]>
1+
2016-05-08 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/unitTests/cpp/Matrix.cpp: Made four scalar/matrix tests less
4+
ambiguous for overloads by using double as scalar
5+
6+
2016-05-06 Dirk Eddelbuettel <[email protected]>
7+
8+
* R/loadRcppModules.R (loadRcppModules): Add call to .Deprecated
9+
pointing out that loadModule is preferred
10+
* man/Rcpp-deprecated.Rd: Added to list deprecated functions
11+
* man/loadRcppModules-deprecated.Rd: Renamed to -deprecated, added link
12+
to loadModule which is the preferred method
13+
14+
* vignettes/Rcpp-modules.Rnw: Updated with respect to loadRcppModules
15+
deprecation and loadModule being preferred
16+
17+
2016-04-15 Kevin Ushey <[email protected]>
218

319
* src/attributes.cpp: Add a missing 'winslash = "/"'
420

5-
2013-05-14 J.J. Allaire <[email protected]>
21+
2016-04-14 J.J. Allaire <[email protected]>
622

7-
* src/attributes.cpp: Correct handling of dependent file paths on Windows (use winslash = "/")
23+
* src/attributes.cpp: Correct handling of dependent file paths on
24+
Windows (use winslash = "/")
825

926
2016-04-13 Dirk Eddelbuettel <[email protected]>
1027

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: Rcpp
22
Title: Seamless R and C++ Integration
3-
Version: 0.12.4.5
4-
Date: 2016-04-15
3+
Version: 0.12.4.6
4+
Date: 2016-05-06
55
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey,
66
Qiang Kou, Douglas Bates and John Chambers
77
Maintainer: Dirk Eddelbuettel <[email protected]>

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exportMethods(prompt, show, .DollarNames, initialize, "formals<-")
1515
export(Module,
1616
Rcpp.package.skeleton,
1717
populate,
18-
loadRcppModules,
18+
loadRcppModules, # deprecated since Rcpp 0.12.5
1919
setRcppClass,
2020
loadRcppClass,
2121
loadModule,

R/loadRcppModules.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1717

18-
loadRcppModules <- function(direct=TRUE){
18+
loadRcppModules <- function(direct=TRUE) {
19+
# deprecation added May 2016, 'loadModule' has been prefered for years
20+
.Deprecated("loadModule")
21+
1922
## hunt for the namespace of the package that calls this
2023
calls <- sys.calls()
2124
w <- which( sapply( calls, function(call){

inst/NEWS.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
\itemize{
2121
\item An apparent race condition in Module loading seen with R 3.3.0 was
2222
fixed (Ben Goodrich in \ghpr{461} fixing \ghit{458}).
23+
\item The (older) \code{loadRcppModules()} is now deprecated in favour of
24+
\code{loadModule()} introduced around R 2.15.1 and Rcpp 0.9.11.
2325
}
2426
}
2527
}

inst/unitTests/cpp/Matrix.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// Matrix.cpp: Rcpp R/C++ interface class library -- Matrix unit tests
44
//
5-
// Copyright (C) 2013 - 2014 Dirk Eddelbuettel, Romain Francois and Kevin Ushey
5+
// Copyright (C) 2013 - 2016 Dirk Eddelbuettel, Romain Francois and Kevin Ushey
66
//
77
// This file is part of Rcpp.
88
//
@@ -313,21 +313,21 @@ CharacterMatrix transposeCharacter(const CharacterMatrix & x) {
313313
}
314314

315315
// [[Rcpp::export]]
316-
NumericMatrix matrix_scalar_plus(const NumericMatrix & x, int y) {
316+
NumericMatrix matrix_scalar_plus(const NumericMatrix & x, double y) {
317317
return x + y;
318318
}
319319

320320
// [[Rcpp::export]]
321-
NumericMatrix matrix_scalar_plus2(const NumericMatrix & x, int y) {
321+
NumericMatrix matrix_scalar_plus2(const NumericMatrix & x, double y) {
322322
return y + x;
323323
}
324324

325325
// [[Rcpp::export]]
326-
NumericMatrix matrix_scalar_divide(const NumericMatrix & x, int y) {
326+
NumericMatrix matrix_scalar_divide(const NumericMatrix & x, double y) {
327327
return x / y;
328328
}
329329

330330
// [[Rcpp::export]]
331-
NumericMatrix matrix_scalar_divide2(const NumericMatrix & x, int y) {
331+
NumericMatrix matrix_scalar_divide2(const NumericMatrix & x, double y) {
332332
return y / x;
333333
}

man/Rcpp-deprecated.Rd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
\name{Rcpp-deprecated}
2+
\alias{Rcpp-deprecated}
3+
\title{Deprecated Functions in the Rcpp Package}
4+
\description{
5+
These functions are provided for compatibility with older versions of the
6+
\pkg{Rcpp} package only, and may be removed in future versions.
7+
}
8+
\details{
9+
\code{loadRcppModules} calls should now be replaced by
10+
\code{\link{loadModule}} calls, one per Module.
11+
}

man/loadModule.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ John Chambers
8181
\seealso{
8282
\code{\link{setRcppClass}()} to avoid the explicit call.
8383

84-
\code{\link{loadRcppModules}()} for a shotgun procedure to load all
84+
\code{\link{loadRcppModules}()} for a (deprecated) shotgun procedure to load all
8585
modules.
8686
}
8787
\examples{

man/loadRcppModules.Rd renamed to man/loadRcppModules-deprecated.Rd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
\name{loadRcppModules}
1+
\name{loadRcppModules-deprecated}
22
\alias{loadRcppModules}
33
\title{
44
Loads Rcpp modules on package startup
55
}
66
\description{
7+
\emph{Note:} As of release 0.16.5, this function is deprecated;
8+
\code{\link{loadModule}} should be used instead.
9+
710
Function to simplify loading Rcpp modules contained in a package.
811
This function must be called from the \code{.onLoad} function of a package.
912
It uses the \code{RcppModules} field of the package \code{DESCRIPTION} file
@@ -18,7 +21,7 @@ loadRcppModules(direct=TRUE)
1821
namespace. Otherwise, the module is exposed. }
1922
}
2023
\seealso{
21-
\code{\link{populate}}
24+
\code{\link{populate}}, \code{\link{loadModule}}
2225
}
2326
\keyword{interface}
2427

vignettes/Rcpp-modules.Rnw

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,11 +908,24 @@ options( prompt = " ", continue = " " )
908908
@
909909

910910
<<eval=FALSE>>=
911-
import( Rcpp )
911+
import(Rcpp)
912912
@
913913

914+
In some case we have found that explicitly naming a symbol can be preferable:
915+
916+
<<eval=FALSE>>=
917+
import(Rcpp, evalCpp)
918+
@
919+
920+
\subsubsection{Load the module}
921+
922+
\paragraph{Deprecated older method using loadRcppModules}
923+
924+
Note: This approach is deprecated as of Rcpp 0.12.5, and now triggers a warning
925+
message. Eventually this function will be withdrawn.
926+
914927
The simplest way to load all functions and classes from a module directly
915-
into a package namespace is to use the \code{loadRcppModules} function
928+
into a package namespace used to be to use the \code{loadRcppModules} function
916929
within the \code{.onLoad} body.
917930

918931
<<eval=FALSE>>=
@@ -937,6 +950,8 @@ with a default value of \texttt{TRUE}. With this default value, all content
937950
from the module is exposed directly in the package namespace. If set to
938951
\texttt{FALSE}, all content is exposed as components of the module.
939952

953+
\paragraph{Preferred current method using loadModule}
954+
940955
Starting with release 0.9.11, an alternative is provided by the
941956
\code{loadModule()} function which takes the module name as an argument.
942957
It can be placed in any \code{.R} file in the package. This is useful as it allows to load

0 commit comments

Comments
 (0)