futureverse / futureverse/future
Non-exportable objects: Add support for future.globals.onReference=function(...) { }
- Dominant language
- R
- Stars
- 1k
- Forks
- 92
- PR merge metrics
- No merged PRs in 30d
Description
Currently, R option `future.globals.onReference` can take values:
* `"ignore"` - don't check for non-exportable objects among globals (fastest)
* `"message"` - produce a message when a non-exportable objects is detected
* `"warning"` - produce a warning when a non-exportable objects is detected
* `"error"` - produce an error when a non-exportable objects is detected
I think it could be useful to provide some further control to savvy users/developers out there. More precisely, support for something like:
```r
options(future.globals.onReference = function(ref) {
# accept / reject 'ref' based on inspect
# Q: What should be returned? Above `"ignore"`, ..., `"error"`, or TRUE/FALSE?
})
```
Having this in place would simplify enabling `future.globals.onReference = "error"` by default. For instance, if it turns out there are references that can indeed be exported (yet to be heard of), then we can fall back to above filter.
OTH, there's alteady an internal `future:::reference_filters()` function that allows us to set, add, drop, reset the list of accepted reference types, e.g. (the following is already set)
```r
future:::reference_filters("append", ignore_envirs = function(ref, typeof, class, ...) {
typeof != "environment"
})
```
Maybe this is enough for now?
Contributor guide
Assessment
This issue has not been assessed yet.