Repository navigation
Simplify read-only model identifiers - #23
wjakethompson merged 9 commits into
Conversation
Keep released S7 compatibility by guarding the new hooks and retaining methods_register() when S7_on_load() is not exported.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #23 +/- ##
==========================================
+ Coverage 94.64% 94.75% +0.11%
==========================================
Files 22 22
Lines 2689 2689
==========================================
+ Hits 2545 2548 +3
+ Misses 144 141 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for merging these changes! I'm planning to submit the next version of S7 to CRAN on November 16 (see RConsortium/S7#786). Would you be able to submit an updated version of dcmstan with these compatibility updates to CRAN before then? Please let me know if you need more time or if there’s anything I can help with. |
|
@t-kalinowski I would be happy to! One question: Currently I have set everything up for the new S7. For example, I updated Lines 1 to 9 in 6cbaff5 Do you have any guidance/resources on how to be compatible with both versions of S7? |
|
Thanks, Jake. For the hooks, you can check for the new exports and keep .onLoad <- function(...) {
if ("S7_on_load" %in% getNamespaceExports("S7")) {
getExportedValue("S7", "S7_on_load")()
} else {
S7::methods_register()
}
}
.onUnload <- function(...) {
if ("S7_on_unload" %in% getNamespaceExports("S7")) {
getExportedValue("S7", "S7_on_unload")()
}
}
if ("S7_on_build" %in% getNamespaceExports("S7")) {
getExportedValue("S7", "S7_on_build")()
}Keep the build hook at the top level, after all method declarations. Using We're planning to submit S7 1.0.0 today, so keeping the new hooks, requiring |
Use a getter-only property for inherited model identifiers so generated S7 constructors use the parent’s initialization and validation. Name
model_argsinlcdm(),loglinear(),hdcm(), andbayesnet()so those arguments still reach the right property with the generated constructors.After construction, model identifiers reject every assignment, including assignment of the existing value, with S7’s read-only property error. Add public constructor and validation regressions for all twelve model types.