refactor: replace .Call() expressions with _impl() function calls#2541
Merged
refactor: replace .Call() expressions with _impl() function calls#2541
.Call() expressions with _impl() function calls#2541Conversation
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Replace .Call() expressions with calls to _impl functions
refactor: replace Jan 24, 2026
.Call() expressions with _impl() function calls
There was a problem hiding this comment.
Pull request overview
This PR refactors R code to replace direct .Call() expressions with their corresponding _impl() wrapper functions, aligning with the codebase convention that .Call() should only be used within auto-generated *_impl() functions in aaa-auto.R.
Changes:
- Replaced 8 direct
.Call()expressions across 4 files with calls to their corresponding_impl()wrapper functions - Updated parameter passing in
adjacency.Rto use string values ("none", "twice", "once") instead of integers, which are then converted by the_impl()functions internally - Removed redundant
on.exit(.Call(R*_igraph_finalizer))calls since these are now handled within the_impl()functions
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| R/operators.R | Replaced .Call() in difference.igraph() (2 occurrences) and complementer() with difference_impl() and complementer_impl() calls |
| R/make.R | Replaced .Call() in graph.bipartite() and make_bipartite_graph() with create_bipartite_impl() calls |
| R/conversion.R | Replaced .Call() in as_edgelist() with get_edgelist_impl() call |
| R/adjacency.R | Replaced .Call() in graph.adjacency.dense() with adjacency_impl() and weighted_adjacency_impl() calls; updated parameter conversion to pass strings instead of integers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaced 8
.Call()expressions with their corresponding_impl()wrappers, aligning with the codebase convention to avoid.Call()outside*_impl()inaaa-auto.R.Changes
Files modified:
R/adjacency.R:adjacency,weighted_adjacencyR/make.R:create_bipartite(2 occurrences)R/operators.R:complementer,difference(2 occurrences)R/conversion.R:get_edgelistKey refactoring: Updated
graph.adjacency.dense()to pass stringmode/loopsparameters directly to_impl()functions instead of pre-converting to integers, since_impl()functions handle this internally.Rationale for non-replaced calls
Remaining
.Call()expressions (~40) cannot be replaced due to:_impl()functions missing parameters (subset,which,edgemaps,circle)_impl()exists: Functions likemybracket2,get_attr_mode,set_verbosevcountinwarn_version()to avoid recursionPrepared with GitHub Copilot assistance.
Original prompt
.Call()expressions with calls to_implfunctions #2539💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.