Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-API calls conundrum #1706

Open
lionel- opened this issue Apr 30, 2024 · 3 comments
Open

Non-API calls conundrum #1706

lionel- opened this issue Apr 30, 2024 · 3 comments

Comments

@lionel-
Copy link
Member

lionel- commented Apr 30, 2024

https://rstudio.github.io/r-manuals/r-exts/The-R-API.html#moving-into-c-api-compliance

Non-problematic:

  • SET_ENVFLAGS(): Remove env_unlock() #1705
  • R_ClosureExpr() / BODY_EXPR(): Used in r_fn_body(), which is only used in zap_srcref(). Should be fine to call R-level body() instead.

Potentially problematic:

  • SET_ENCLOS(): Used to mutate parent environment in quosure evaluation inside data masks. It would be helpful if we could continue to use it to avoid a perf hit when evaluating with many groups. See also Remove SET_ENCLOS() usage #1707

Problematic:

  • SETLENGTH() / SET_TRUELENGTH(): Used in rlang C API for resizing. Would be nice to get these added to the official API. Also used in vctrs and data.table.

🔥🔥🔥 :

@lionel-
Copy link
Member Author

lionel- commented Jun 24, 2024

SETLENGTH() / SET_TRUELENGTH(): Used in rlang C API for resizing.

@DavisVaughan proposed to use ALTREP views for resizing to length.

@lionel-
Copy link
Member Author

lionel- commented Jul 2, 2024

Found non-API calls to R:

@lionel-
Copy link
Member Author

lionel- commented Jul 2, 2024

Requests/contribs for R core (WIP):

  • C version of delayedAssign (needed for magrittr placeholder)
  • Predicate to test if a binding is a promise (needed for rlang's env-printer, to prevent arbitrary executions while inspecting envs, etc). Could probably take the form of a "binding type" function that returns an extensible enum.
  • To work around LEVELS() in (see rlang Remove LEVELS() accessor #1726), a predicate to determine if a CHARSXP is encoded in UTF8. Added in wch/r-source@0c753e4
  • Version of getVar() that returns error codes? We either can't afford protecting ourselves from these jumpy R errors, or we'd like to throw our own errors with tailored messages r-devel/r-svn@29a2fda
    Or better, a function that returns the binding type:
    -> direct, promiseDelayed, promiseForced, active, missing, unbound.

Speculative:

  • Iterator for attribute lists, to work around the removal of ATTRIB()?
    Or at least a way to get the attribute names?

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

No branches or pull requests

1 participant