Skip to content

Evolution vignette and compat lab - #731

Draft
hadley wants to merge 7 commits into
mainfrom
evolution-vignette
Draft

Evolution vignette and compat lab#731
hadley wants to merge 7 commits into
mainfrom
evolution-vignette

Conversation

@hadley

@hadley hadley commented Jul 27, 2026

Copy link
Copy Markdown
Member

Closes #143.

Adds vignette("evolution"): how to change your S7 generics and classes without breaking downstream packages, written from the perspective of the upstream author. It covers the design rules that make evolution cheap (leading section), how S7 couples packages (what runs at install vs load vs run time, and the generic–method formals contract), then works change-by-change through generics (add/remove argument, change default, rename, change dispatch, move to another package) and classes (add/remove/rename property, narrow a type, rename, make abstract), with a transition recipe for each.

Every claim is verified by a new manually-run compat lab in tools/evolution/: 20 scenarios that build real evoA/evoB package pairs, upgrade evoA, and record what breaks at evoB's install, load, test, and R CMD check stages (results committed in results.md, tempdir-scrubbed for clean diffs). A release_bullets() entry reminds us to re-run it before each release and reconcile the vignette.

Notes for review:

🤖 Generated with Claude Code

hadley added 4 commits July 27, 2026 17:01
A manually-run harness (tools/evolution/) that verifies what happens to a
downstream package when an upstream S7 package changes its generics or
classes. Groundwork for the evolution vignette (#143).
vignette("evolution") explains how to change S7 generics and classes
without breaking downstream packages, from the perspective of an upstream
author. Every claim is verified by the compat lab in tools/evolution/,
which now covers 20 scenarios including generic moves, deprecating
wrappers, and NAMESPACE re-export vs binding-copy re-exports.

release_bullets() reminds us to re-run the lab before each release.

Spun off during verification: #726, #727, #728, #729, and the
abstract-parent gap reported on #717.
Describes intended behavior once #726, #727, #728, #729, #730, and the
abstract-parent fix on #717 are implemented, with a prominent TODO linking
to each issue so the text can be reconciled (and the lab re-run) as each
fix lands.
…s.Rmd

Designing for evolution now leads the evolution vignette, since it's the
part every upstream author should read even if they never change anything.
The new_external_class() bullet moves to packages.Rmd: it's advice for the
downstream package, not for the upstream author.
@hadley
hadley marked this pull request as draft July 27, 2026 22:57
hadley added 3 commits July 30, 2026 17:27
Regenerates tools/evolution/results.md against the merged fixes and
rewrites the affected sections:

* Consistency checks between generic and method now only run in
  development contexts (#726, #728), so pkgB's users no longer see the
  warnings, and the two error cases surface at run time rather than
  blocking installation.
* Moving a generic to another package now works for an already-installed
  pkgB (#729).
* An abstract external parent can be subclassed (#717), so making a class
  abstract no longer breaks downstream subclasses.

Also corrects the claim that a method's default wins over the generic's:
dispatch passes on the generic's formals, so the generic's default is what
methods actually receive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Evolution vignette

1 participant