[Rd] [External] defer removal of ENCLOS, FRAME, HASHTAB, SET_ENCLOS?

Thomas Friedrichsmeier thom@@@|r|edr|ch@me|er @end|ng |rom kdem@||@net
Mon Mar 23 22:24:37 CET 2026


Am Sun, 22 Mar 2026 14:05:47 -0500 (CDT)
schrieb luke-tierney--- via R-devel <r-devel using r-project.org>:
[...]> 
> > rs <- "/Applications/RStudio.app/Contents/Resources/app/bin/rsession-arm64"
> > subset(tools:::checkObjAPI(rs), type == "F" & is.na(apitype))$name  
>   [1] "ATTRIB"              "BODY"                "CLOENV"
>   [4] "ENCLOS"              "FORMALS"             "FRAME"
>   [7] "HASHTAB"             "locale2charset"      "NAMED" 
> [10] "OBJECT"              "PRCODE"              "PRENV" 
> [13] "PRVALUE"             "R_findVarLocInFrame" "R_lsInternal" 
> [16] "RDEBUG"              "Rf_findVar"          "Rf_findVarInFrame" 
> [19] "Rf_findVarInFrame3"  "Rf_sortVector"       "SET_ENCLOS" 
> [22] "SET_NAMED"           "SET_PRVALUE"         "SET_RDEBUG" 
> [25] "SYMVALUE" 
> > subset(tools:::checkObjAPI(rs), type == "V" & is.na(apitype))$name  
> [1] "R_InputHandlers"  "R_SignalHandlers" "SaveAction"
> 
> If you think some of these should be in the API you can make a case
> for that.

Writing for RKWard, we are using the promise-related functions (PRCODE, PRENV,
PRVALUE, and their SET-equivalents). Our use case is to allow to "peek" into
bindings without (permanently) forcing them (debugger, object browser, code
completion). I.e. after evaluation we try to restore the original promise
(naturally, not all side effects can be undone, but for the most part, this
does what we want). I am not aware of an existing replacement. One conceivable
replacement for our use case would be a single function to make a
deep/independent copy of an unevaluated promise.

We are also using R_lsInternal(3), and Rf_findVarInFrame. These can certainly
be replaced, but are highly convenient. To a lesser extent the same goes for
FORMALS. IIRC, our motivation for using that was simply performance, although I
do not recall how much of a difference it made.

Further we are using R_InputHandlers, in conjunction with addInputHandler and
R_runHandlers. I would have to evaluate that (old) code quite carefully, but
we do need the ability to insert our own handlers into the event loop as well
as running all existing handlers.

Regards
Thomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: Digitale Signatur von OpenPGP
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20260323/49eb3ef5/attachment.sig>


More information about the R-devel mailing list