When a public function's signature is migrated (e.g., by inserting ... and renaming arguments), Stimulus uses argument-migration blocks to prevent breaking existing calls. These blocks recover legacy calls by position or by (partial) name and emit a soft-deprecation.
Implementation Details
- Source of Truth: Migration definitions are stored in
tools/migrations/<topic>.R registry files. Each entry declares the old and new signatures. - Generation: The tool
tools/generate-migrations.R reads these registries and rewrites the code between # BEGIN GENERATED ARG_HANDLE: <fn> and # END GENERATED ARG_HANDLE markers inside the R functions. - Usage: The generated block uses
lifecycle::deprecate_soft() to warn users without silencing internal igraph callers.
Warning: Do not edit the code between the # BEGIN and # END markers by hand. They are regenerated automatically.
Regenerating migrations
After editing a registry file in tools/migrations/, run:
Rscript tools/generate-migrations.R
Migration Best Practices
To reorder an argument or drop a positional slot without breaking old calls, place the affected argument after ... in the new signature. Arguments following the ellipsis are treated as keyword-only and are recovered by name rather than position.