Skip to content

Non-API calls conundrum #1706

Open
Open

Description

@lionel-

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.

🔥🔥🔥 :

Activity

  1. lionel- commented on Jun 24, 2024

    @lionel-
    MemberAuthor

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

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

  2. lionel- commented on Jul 2, 2024

    @lionel-
    MemberAuthor

    Found non-API calls to R:

  3. lionel- commented on Jul 2, 2024

    @lionel-
    MemberAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions