Open Kevin-Jin opened 7 years ago
mmap
objects already depart from copy-on-write semantics because they extend environment
types and because calls to mmap_replace()
affect the value of all references to the mmap
object. In other words, mmap
objects are passed by reference rather than passed by value.
Add an optional parameter to the
as.mmap()
functions that set the default behavior for the subset operator`[`
and also add an optional parameter to`[`
(similar to the basedrop
parameter). Users should have the option of either (1) retrieving anothermmap
object that transparently refers to different offsets of the parentmmap
object (using sets of ordered pairs representing start indices and range lengths), or (2) callingextractFUN
on the subset.Naturally, many additional functions will need to be overridden so that useful operations can be performed in place on the
mmap
object. The list of functions overridden in theffbase
CRAN package is probably a good start.It will be important to document this departure from R's standard copy-on-write semantics when the feature is released. The optional parameter in
as.mmap()
should default to callingextractFUN
on subsets.