Skip to content

Allow a package to be re-sourced while methods are out of sync with a changed generic #726

Closed

Description

@hadley

Split out from the discussion in #143:

One last note: when you change a generic() it's nice to be able to still successfully source the whole package so that you can fix methods one-by-one, rather than having to update them all before your package re-loads successfully.

Today, changing a generic's interface makes method<- error at registration time via check_method(), so devtools::load_all() (and installation) fails until every method has been updated. The errors come from:

  • A generic without ...: method formals must match the generic's formals exactly.
  • The method's leading arguments must match the generic's dispatch args, in order.
  • Dispatch args must not have default values.

(Argument additions and default-value changes are already only warnings.)

Whatever the design, R CMD check should still surface the inconsistency loudly; the goal is only to keep the package sourceable mid-refactor.

Activity

  1. hadley commented on Jul 27, 2026

    @hadley
    MemberAuthor

    Maybe warn instead of erroring if pkgload::is_loading() is TRUE. What do you think @t-kalinowski ?

  2. added a commit that references this issue on Jul 31, 2026
  3. added a commit that references this issue on Oct 2, 2026
    642fe0d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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