The stopifnot_ma_safe2mutate()
function
checks if an atomic object is actually safe to mutate.
The .internal_set_ma()
function
sets an object to class 'mutatomic' by reference.
Examples
testfun1 <- function(x) {
.internal_set_ma(x)
}
x <- 1:10
is.mutatomic(x)
#> [1] FALSE
testfun1(x)
is.mutatomic(x)
#> [1] TRUE
print(x)
#> [1] 1 2 3 4 5 6 7 8 9 10
#> mutatomic
#> typeof: integer