You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Should parent.frame() in S7 methods match S3? #596
We should discuss this. I think there's some disagreement about how much we want to elide the details of method dispatch. I think I'd prefer to keep it explicit (as long as it's consistent, so that parent.frame(2) would always get you the caller of the generic).
I wonder if we should expose two helpers for what you'd typically use parent.frame() — getting the frame of the generic (for error messages) and getting the user frame (for various NSE shenanigans). If we provided these helpers we could ensure that they always worked even when super() was in the mix.
That would also free us to consider alternative implementation in the future.
Not yet. The dispatcher still uses Rf_findVarInFrame() to forward argument promises, preserving substitute(), missing(), and lazy evaluation. That remains tracked in #592. The new context helpers give us room to change the dispatch implementation, but they don’t themselves replace the argument-forwarding machinery.
Not yet. The dispatcher still uses Rf_findVarInFrame() to forward argument promises, preserving substitute(), missing(), and lazy evaluation. That remains tracked in #592. The new context helpers give us room to change the dispatch implementation, but they don’t themselves replace the argument-forwarding machinery.
Thanks. I'll try to get back to this in the next month or two.
Activity
hadley commentedon May 21, 2026
We should discuss this. I think there's some disagreement about how much we want to elide the details of method dispatch. I think I'd prefer to keep it explicit (as long as it's consistent, so that
parent.frame(2)would always get you the caller of the generic).lawremi commentedon May 22, 2026
To clarify, it's consistency with both S3 and S4.
I agree that it's confusing when the return value of
sys.parents()repeats values (andparent.frame()skips frames):The
at #1is not intuitive and is easy to miss.Of course with the current S7 implementation, the same complexity exists, and there isn't even an indicator in the trace:
One direction would be to improve the clarity of the traces, so that the user understands what is happening.
hadley commentedon Jun 1, 2026
I wonder if we should expose two helpers for what you'd typically use
parent.frame()— getting the frame of the generic (for error messages) and getting the user frame (for various NSE shenanigans). If we provided these helpers we could ensure that they always worked even whensuper()was in the mix.That would also free us to consider alternative implementation in the future.
lawremi commentedon Jun 2, 2026
Yes, those helpers be.. helpful.. regardless of what we do with this issue. Abstraction is a good idea here.
hadley commentedon Jun 3, 2026
Maybe
S7_generic_frame()andS7_user_frame()?lawremi commentedon Jun 3, 2026
Seems reasonable.
ltierney commentedon Sep 30, 2026
Does this mean S7 can now stop using
R_findVarInFrame?t-kalinowski commentedon Sep 30, 2026
Not yet. The dispatcher still uses
Rf_findVarInFrame()to forward argument promises, preservingsubstitute(),missing(), and lazy evaluation. That remains tracked in #592. The new context helpers give us room to change the dispatch implementation, but they don’t themselves replace the argument-forwarding machinery.ltierney commentedon Oct 2, 2026
Thanks. I'll try to get back to this in the next month or two.