-
Notifications
You must be signed in to change notification settings - Fork 8
Remove R6 interface for epi_archive
s
#340
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
Comments
This is blocking or slowing every additional feature we want to add to |
I would add this to the kanban, but I apparently don't have permissions here? Could someone add me as a writer? Better yet, the entire forecasting-maintainers list. |
|
TODO:
|
Adding Attempt at task breakdown:
Potentially later:
|
Could this work for |
No, unfortunately. Merely loading dtplyr via :: calls is enough to trigger dtplyr S3 stuff.
|
Oh wait! dtplyr 1.3.0 might have fixed this! [Side note... I'm not sure I think we have tests that fail by loading older |
Looking for places where mutable aliasing might occur, I searched the repo for uses of
|
slide.R is using dplyr/tidyverse's :=, not data.table's, and is not archive related, so that should be good. data.table::set* functions also mutate, any of those? Also, certain as.data.table or similar calls might(?) think they can take ownership, based on attrs set beforehand and/or explicit parameters [and if they think they need to sort might do it in place, mutating]. If we do use these though it would probably have to be knowingly and with a good amount of thought already into them already; I don't think data.table would do this without user effort involved. |
Thanks. Going through the "See Also" part of the set* docs I found these functions and searched for them all (on this commit fd2339d):
The following functions appear to be safe, even in the case of noop: |
I might not be following the flow of operations correctly here, but I think this is probably safe. Let's say |
From discussion in #181 and off GitHub: in
epi_archive
we are currently paying the costs of maintaining a separate R6 interface and considering details of aliasing and mutation, but none of our operations actually benefit from the ability to use mutation, and we've eliminated or don't use some of the other benefits of R6 (keeping package namespace clean,print
, cross-package inheritance details).archive$<fn>()
parts of the interface.]data.table
(see below), we still need to be careful about documenting aliasing of DTs.epi_archive
andgrouped_epi_archive
to S3 classes, not R6.c("grouped_epi_archive", "epi_archive")
or just"grouped_epi_archive"
? The former is more consistent with dplyr, but the latter is less error-prone."grouped_epi_archive"
.epi_archive
s that might start "working" and doing wrong things as lists? (E.g.,c
?rbind
?)is_epi_archive
etc. on saved archives from older versions. We don't have a format version attribute now, so we'd need to check if it's an R6 object for example. Maybe we should add an attr now indicating the "archive format version"?lazy_dt
, so we don't have to mention aliasing at all, and to try to improve performance.data.table
.lazy_dt
might be nice except it would mean simply loading epiprocess can break unrelated user code using dplyr + non-dtplyr data.tables.data.table
for now, but we will need to check that (i) none of ourepix_
methods mutate DT without copying it first (or doing sneaky things aliasing columns), and (ii) that we warn the user that if they should do the same (minus the sneaky things part at least).The text was updated successfully, but these errors were encountered: