[Rd] Non-mutable ALTREP objects

Gábor Csárdi c@@rd|@g@bor @end|ng |rom gm@||@com
Tue Jun 8 11:59:11 CEST 2021


Dear all,

I have another ALTREP question. In the
https://github.com/ALTREP-examples/Rpkg-simplemmap example, it is
possible to mmap a file read-write with wrtOK = TRUE.

This is a pretty cool use case, one can change the mapped vector (in
C), and the change is synchronized with the file, and also other
processes that map the same file.

On the other hand, I wonder if it violates some contract, because it
means that an R object might change without any code touching it, if
the mapped file is updated from another R session or through another
variable.

Does this violate the pass by value semantics?

Can this cause issues in the interpreter or the byte code compiler? Or
is there some guarantee that evaluating these objects will always call
their ALTREP methods?

FWIW these objects are marked as non-mutable. Does that change anything?

Thank you,
Gabor



More information about the R-devel mailing list