Skip to content

user-defined opDefs in a user package can't be located (with a proposed solution) #118

@paciorek

Description

@paciorek

So it looks like we need to revise how user-defined opDefs are found.

Currently, registerOpDef puts them in nCompiler:::operatorDefUserEnv.

However, if an opDef is registered at build time as part of a user package, those changes to nCompiler:::operatorDefUserEnv will of course not be available at run time when the user package is being used.

Here's a proposal for what I think we need to do:

  • when registerOpDef is called, if it's done in the context of a package namespace (presumably based on a new argument, where = parent.frame()), create userPkg:::operatorDefUserEnv (if needed) and put the opDefs there.
  • then when we go to look for an opDef, we should use nGet to look for operatorDefUserEnv, finding it in the userPkg namespace if present and then in the nCompiler namespace, based on it being an imports of userPkg.

I suppose we could tell package developers to register opDefs via onLoad() but that doesn't feel right.

@perrydv what do you think? Does that plan sound reasonable? Other ideas? I can implement once we decide on a path forward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions