Skip to content

Non-exportable objects: Add support for future.globals.onReference=function(...) { } #335

@HenrikBengtsson

Description

@HenrikBengtsson

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:

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)

future:::reference_filters("append", ignore_envirs = function(ref, typeof, class, ...) {
  typeof != "environment"
})

Maybe this is enough for now?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions