Skip to content

Commit d0112a1

Browse files
authored
* Fix vignette titles * Enable parallel testing * Simplify matrixOps definition
1 parent 3d6c6d7 commit d0112a1

8 files changed

+19
-22
lines changed

DESCRIPTION

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ VignetteBuilder:
4242
knitr
4343
Config/Needs/website: sloop
4444
Config/testthat/edition: 3
45+
Config/testthat/parallel: TRUE
46+
Config/testthat/start-first: external-generic
4547
Encoding: UTF-8
4648
Roxygen: list(markdown = TRUE)
4749
RoxygenNote: 7.2.3

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ if (getRversion() >= "4.3.0") S3method(matrixOps, S7_object)
9090
if (getRversion() >= "4.3.0") S3method(nameOfClass, S7_class, S7_class_name)
9191
importFrom(stats,setNames)
9292
importFrom(utils,getFromNamespace)
93+
importFrom(utils,globalVariables)
9394
importFrom(utils,hasName)
9495
importFrom(utils,head)
9596
importFrom(utils,packageName)

R/S7-package.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## usethis namespace: start
2-
#' @useDynLib S7, .registration = TRUE
2+
#' @importFrom utils globalVariables
33
#' @importFrom utils head str hasName
4+
#' @useDynLib S7, .registration = TRUE
45
## usethis namespace: end
56
NULL

R/method-ops.R

+10-10
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ Ops.S7_object <- function(e1, e2) {
2323
chooseOpsMethod.S7_object <- function(x, y, mx, my, cl, reverse) TRUE
2424

2525
#' @rawNamespace if (getRversion() >= "4.3.0") S3method(matrixOps, S7_object)
26-
matrixOps.S7_object <- NULL
26+
matrixOps.S7_object <- function(x, y) {
27+
base_matrix_ops[[.Generic]](x, y)
28+
}
29+
2730

2831
on_load_define_matrixOps <- function() {
29-
if (getRversion() >= "4.4.0") {
30-
matrixOps.S7_object <<- function(x, y) {
31-
base_matrix_ops[[.Generic]](x, y)
32-
}
33-
} else {
34-
matrixOps.S7_object <<- function(e1, e2) {
35-
base_matrix_ops[[.Generic]](e1, e2)
36-
}
37-
}
32+
# if (getRversion() >= "4.3.0") {
33+
# } else {
34+
# matrixOps.S7_object <<- function(e1, e2) {
35+
# base_matrix_ops[[.Generic]](e1, e2)
36+
# }
37+
# }
3838
}

vignettes/classes-objects.Rmd

-1
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,3 @@ The first argument to `new_object()` should be an object of the `parent` class (
283283
That argument should be followed by one named argument for each property.
284284

285285
There's one drawback of custom constructors that you should be aware of: any subclass will also require a custom constructor.
286-

vignettes/generics-methods.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Generics and methods"
33
output: rmarkdown::html_vignette
44
vignette: >
5-
%\VignetteIndexEntry{S7 generics and method dispatch}
5+
%\VignetteIndexEntry{Generics and methods}
66
%\VignetteEngine{knitr::rmarkdown}
77
%\VignetteEncoding{UTF-8}
88
---

vignettes/motivation.Rmd

+2-8
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ library(S7)
6363
This made it possible to make radical changes but it made it harder to switch from S3 to S4, leading to a general lack of adoption in the R community.
6464
S7 is designed to be drop-in compatible with S3, making it possible to convert existing packages to use S7 instead of S3 with only an hour or two of work.
6565

66-
```{=html}
6766
<!-- -->
68-
```
69-
- At least within Bioconductor, slots are generally thought of as implementation detail that should not be directly accessed by the end-user.
70-
This leads to two problems.
71-
Firstly, implementing an S4 Bioconductor class often also requires a plethora of accessor functions that are a thin wrapper around `@` or `@<-`.
72-
Secondly, users know about `@` and use it to access object internals even though they're not supposed to.
73-
S7 avoids these problems by accepting the fact that R is a data language, and that there's no way to stop users from pulling the data they need out of an object.
74-
To make it possible to change the internal implementation details of an object while preserving existing `@` usage, S7 provides dynamic properties.
67+
68+
- At least within Bioconductor, slots are generally thought of as implementation detail that should not be directly accessed by the end-user. This leads to two problems. Firstly, implementing an S4 Bioconductor class often also requires a plethora of accessor functions that are a thin wrapper around `@` or `@<-`. Secondly, users know about `@` and use it to access object internals even though they're not supposed to. S7 avoids these problems by accepting the fact that R is a data language, and that there's no way to stop users from pulling the data they need out of an object. To make it possible to change the internal implementation details of an object while preserving existing `@` usage, S7 provides dynamic properties.

vignettes/packages.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Using S7 in a package"
33
output: rmarkdown::html_vignette
44
vignette: >
5-
%\VignetteIndexEntry{packages}
5+
%\VignetteIndexEntry{Using S7 in a package}
66
%\VignetteEngine{knitr::rmarkdown}
77
%\VignetteEncoding{UTF-8}
88
---

0 commit comments

Comments
 (0)