Skip to content

refactor: Replace _impl aliases with explicit wrapper functions in R/games.R#2383

Merged
krlmlr merged 5 commits intomainfrom
copilot/replace-impl-aliases-in-games
Oct 25, 2025
Merged

refactor: Replace _impl aliases with explicit wrapper functions in R/games.R#2383
krlmlr merged 5 commits intomainfrom
copilot/replace-impl-aliases-in-games

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 25, 2025

Replaced all 11 direct _impl function aliases in R/games.R with explicit wrapper functions that forward arguments individually.

Changes Made

All functions now use explicit wrappers instead of direct aliasing:

  • sample_growing - forwards: n, m, ..., directed, citation
  • sample_sbm - forwards: n, pref.matrix, block.sizes, directed, loops
  • sample_dot_product - forwards: vecs, directed
  • sample_islands - forwards: islands.n, islands.size, islands.pin, n.inter
  • sample_k_regular - forwards: no.of.nodes, k, directed, multiple
  • sample_chung_lu - forwards: out.weights, in.weights, ..., loops, variant
  • sample_fitness - forwards: no.of.edges, fitness.out, fitness.in, loops, multiple
  • sample_fitness_pl - forwards: no.of.nodes, no.of.edges, exponent.out, exponent.in, loops, multiple, finite.size.correction
  • sample_forestfire - forwards: nodes, fw.prob, bw.factor, ambs, directed
  • sample_correlated_gnp - forwards: old.graph, corr, p, permutation
  • sample_correlated_gnp_pair - forwards: n, corr, p, directed, permutation

Each wrapper explicitly forwards arguments using arg = arg notation. The ... parameter is only used where the function signature requires it (sample_growing and sample_chung_lu).

Testing

  • ✅ All 6952 tests pass
  • ✅ Documentation updated with devtools::document()
  • ✅ Manual testing confirms all wrapped functions work correctly

Fixes #2348

Original prompt

This section details on the original issue you should resolve

<issue_title>Replace _impl aliases in R/games.R</issue_title>
<issue_description>Goal
Review the code in R/games.R and replace all direct _impl function aliases with explicit wrapper functions.

Functions to update:

  • sample_growing <- growing_random_game_impl
  • sample_sbm <- sbm_game_impl
  • sample_dot_product <- dot_product_game_impl
  • sample_islands <- simple_interconnected_islands_game_impl
  • sample_k_regular <- k_regular_game_impl
  • sample_chung_lu <- chung_lu_game_impl
  • sample_fitness <- static_fitness_game_impl
  • sample_fitness_pl <- static_power_law_game_impl
  • sample_forestfire <- forest_fire_game_impl
  • sample_correlated_gnp <- correlated_game_impl
  • sample_correlated_gnp_pair <- correlated_pair_game_impl

Instructions

  1. Review the code to understand the function signatures
  2. Create explicit wrapper functions that forward to the _impl functions
  3. Forward each argument individually and explicitly using arg = arg notation
  4. Do not use ... unless the _impl function itself uses ...

Pattern
Replace direct aliasing like:

func_name <- func_name_impl

With an explicit wrapper:

func_name <- function(arg1, arg2, ...) {
  func_name_impl(
    arg1 = arg1,
    arg2 = arg2,
    ...
  )
}

File
R/games.R</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@krlmlr
Copy link
Copy Markdown
Contributor

krlmlr commented Oct 25, 2025

@copilot: Proceed.

Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 25, 2025

@copilot: Proceed.

Done! All 11 _impl aliases in R/games.R have been replaced with explicit wrapper functions. Each wrapper forwards arguments individually using arg = arg notation, and ... is only used where the function signature requires it. All tests pass (6952 passing). Changes committed in 9f67107.

Copilot AI changed the title [WIP] Replace _impl aliases with explicit wrapper functions Replace _impl aliases with explicit wrapper functions in R/games.R Oct 25, 2025
@krlmlr krlmlr changed the title Replace _impl aliases with explicit wrapper functions in R/games.R refactor: Replace _impl aliases with explicit wrapper functions in R/games.R Oct 25, 2025
@krlmlr krlmlr marked this pull request as ready for review October 25, 2025 19:50
@krlmlr krlmlr enabled auto-merge (squash) October 25, 2025 19:50
@krlmlr krlmlr merged commit 6d2bed1 into main Oct 25, 2025
1 check passed
@krlmlr krlmlr deleted the copilot/replace-impl-aliases-in-games branch October 25, 2025 20:17
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.

Replace _impl aliases in R/games.R

2 participants