Skip to content

Create derived nClasses during .onLoad? #13

@perrydv

Description

@perrydv

An nClass in a package like nimbleModel will always inherit from the nClass base class, which is in nCompiler.

As described in this R6 documentation page, it can be better to create a derived cross-package R6 class (nClasses are R6 classes) in .onLoad so that they are instantiated when the package is loaded, not when the package is built. That means they will pick up any changes from updates to the package with the base class (nCompiler in this case). If they are made when the package is built, then the package would need to be rebuilt when the base class package changes. This could easily create problems.

This issue does not propose a change right now but just keeps the issue in scope. If we move to .onLoad, I think we'd also need to make the model and declFun base classes not be predefined classes, and that would take a little tweaking so that the couple of lines code that are currently manually inserted could be automatically inserted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions