collections
collections copied to clipboard
Backwards compatibility issue
Hi,
Thanks for creating this package it has been a great help.
I was using v0.3.3 and had saved the object, then upgraded to v0.3.5. When I read the v0.3.3 object into a v0.3.5 environment I get the following error: Error in missing_arg(default) : could not find function "missing_arg". If I re-create the same hash using v0.3.5 everything works OK.
Reproducible Example:
# install v0.3.3 & v0.3.5
devtools::install_version(
"collections",
version = "0.3.3",
lib = "~/v3.3"
)
devtools::install_version(
"collections",
version = "0.3.5",
lib = "~/v3.5"
)
# create and save hash in v0.3.3
detach("package:collections", unload = TRUE)
library("collections", lib = "~/v3.3")
h3.3 <- dict(
items = list(1, 2, 3),
keys = list("A", "B", "C")
)
saveRDS(h3.3, file = "~/v3.3.rds")
# load v0.3.5
detach("package:collections", unload = TRUE)
library("collections", lib = "~/v3.5")
h3.3 <- readRDS(file = "~/v3.3.rds")
h3.3$get("A")
# Error in missing_arg(default) : could not find function "missing_arg"
# create and test new hash in v0.3.5
h3.5 <- dict(
items = list(1, 2, 3),
keys = list("A", "B", "C")
)
h3.5$get("A")
Unfortunately, the dict object is not meant to be portable in such way. It is very easy to break things. We might need to encapsulate the whole closure in order to make it portable.
Thank you for raising the issue though.
Actually it isn't limited to this package. A lot of other packages are subjected to break if an object is serialised and deserialised under different versions.