Skip to content

Move the remaining hand-written legacy-argument bridges into the migration registry #3055

Backlog

Description

@schochastics

The #2788 rename stack (#2859 to #2951) handles most legacy argument names through the migration registry: the generator in tools/generate-migrations.R writes the code that keeps the old names working. #2859 extended it to head arguments (the arguments before ...): the old name stays as a trailing deprecated() formal, and a call that names it is matched again against the pre-3.0.0 signature before each value is bound to its new name.

35 renames in functions without a registry entry still use a hand-written bridge instead, for example in head_of():

if (lifecycle::is_present(es)) {
  if (!missing(edges)) {
    cli::cli_abort(c(
      "Argument {.arg edges} of {.fn head_of} was supplied more than once.",
      i = "It was also supplied via its legacy name {.arg es}."
    ))
  }
  lifecycle::deprecate_soft("3.0.0", "head_of(es = )", "head_of(edges = )")
  edges <- es
}

They behave correctly today. The reasons to convert them anyway:

  • There are two mechanisms for the same job, and the hand-written one is easy to copy wrong.
  • A bridge only forwards the named value. It cannot move positional values that followed the old argument, which is what broke set_vertex_attr(g, "x", index = i, v) in CurricularComplexity, martini and miloR until the generator took that function over. None of the functions below has such a positional follower now, but adding one later would bring the problem back without any test failing.

Registry entry possible (27)

These need an entry in tools/migrations/ (rename only, without ..., where the function has none; see tools/migrations/README.md, section "Head renames") and the bridge removed.

Function Legacy New Added in
hits_scores() scale normalized #2862
bibcoupling() v vertices #2864
cocitation() v vertices #2864
count_triangles() vids vertices #2864
delete_vertices() v vertices #2864
isomorphism_class() v vertices #2864
max_degree() v vertices #2864
count_multiple() eids edges #2943
head_of() es edges #2943
reverse_edges() eids edges #2943
tail_of() es edges #2943
which_loop() eids edges #2943
which_multiple() eids edges #2943
edge_attr() index edges #2944
set_vertex_attrs() index vertices #2944
vertex_attr() index vertices #2944
keeping_degseq() niter n_iter #2945
match_vertices() iteration max_iter #2945
realize_bipartite_degseq() allowed.edge.types allowed_edge_types #2946
cluster_fluid_communities() no.of.communities n_communities #2948
assortativity() values.in values_in #2950
component_distribution() mul.size mul_size #2950
dfs() in.callback in_callback #2950
dfs() order.out order_out #2950
dfs() out.callback out_callback #2950
eccentricity() vids vertices #2950
realize_bipartite_degseq() method algorithm #2951

Need a decision first (8)

  • The isomorphism functions forward ... to the per-algorithm backends. Their entries need passthrough_dots = TRUE, like fit_power_law() and local_scan(), and a check that no backend argument collides with a name of the old signature.
  • compare(): the bridge lives in the S3 methods, because a value reassigned in the generic does not reach the method. The generator does not handle S3 methods yet.
Function Legacy New Added in
compare.communities() method measure #2951
compare.membership() method measure #2951
count_isomorphisms() method algorithm #2951
count_subgraph_isomorphisms() method algorithm #2951
isomorphic() method algorithm #2951
isomorphisms() method algorithm #2951
subgraph_isomorphic() method algorithm #2951
subgraph_isomorphisms() method algorithm #2951

Nothing user-visible changes, so this can land after 3.0.0.

Activity

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