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
Investigate and remove Rf_findVarInFrame3 usage in environment #367
Likely going to use R_existsVarInFrame() in exists() on R >=4.2.0
And then likely going to use the new R_getVarEx() on >=R-devel, although it has different semantics than Rf_findVarInFrame3(env, sym, TRUE) in edge cases, i.e.:
For R_MissingArg values in the env, R_getVarEx() errors
For promises in the env, R_getVarEx() will evaluate them before returning them
I don't think there is anything we can do about this unless we get an iterator API for environments that doesn't add special behavior like this
And then for the fallback for older R versions we call Rf_findVarInFrame3() but then add 3 checks to reimplement the 3 bullets from above, so the behavior is consistent on all R versions.
After the enum / iterator API for environments is released, people will have more options if they want to manually implement more advanced behaviors than this "safe" way.
Activity
DavisVaughan commentedon Aug 3, 2024
Likely going to use
R_existsVarInFrame()inexists()on R >=4.2.0And then likely going to use the new
R_getVarEx()on >=R-devel, although it has different semantics thanRf_findVarInFrame3(env, sym, TRUE)in edge cases, i.e.:R_MissingArgvalues in the env,R_getVarEx()errorsR_getVarEx()will evaluate them before returning themI don't think there is anything we can do about this unless we get an iterator API for environments that doesn't add special behavior like this
DavisVaughan commentedon Aug 5, 2024
Lionel and I decided that for the proxy
SEXPconversion method, we should use the newR_getVar()function (not the extended version), which would:R_MissingArg(definitely what R Core wants from us)exists()first, also good to not exposeR_UnboundValue)https://github.com/wch/r-source/blob/0986e80068addc5c884d06580412ff2331436814/src/main/envir.c#L2305
And then for the fallback for older R versions we call
Rf_findVarInFrame3()but then add 3 checks to reimplement the 3 bullets from above, so the behavior is consistent on all R versions.After the enum / iterator API for environments is released, people will have more options if they want to manually implement more advanced behaviors than this "safe" way.