Skip to content

Instantly share code, notes, and snippets.

@lionel-
lionel- / source-unwind.R
Last active February 24, 2022 16:00
Unwinding scope in `source()`
# Prototype of `source()` as currently implemented
source2 <- function(file, env = parent.frame()) {
exprs <- parse(file)
for (expr in exprs) {
eval(expr, env)
}
}
# Prototype of `source()` using an evaluation strategy where the
# unwinding scope is the whole file rather than each line
Homebrew build logs for [email protected] on macOS 13
Build date: 2023-04-02 14:50:46
Homebrew build logs for [email protected] on macOS 13
Build date: 2023-04-02 14:50:46
@lionel-
lionel- / tidyverse-c-api-compat.md
Last active April 22, 2025 10:15
Compatibility of tidyverse with the public C API of R

Summary of meeting between Tidyverse members and Luke Tierney at useR! 2024.

Frame/Environment inspection

Frontends and low level tools need to know what kind of bindings they are dealing with. Objectives include:

  • Avoiding side effects such as triggering a promise or causing a missing argument error. Low level tools often can't afford to protect against those for every variable lookup. Figuring out what happened by inspecting errors is also ambiguous, and sometimes impossible (promises may cause longjumps in a variety of ways).

  • Transparency in debugging/development settings. Providing context to the user about what's going to happen if they attempt to retrieve the value of a binding (i.e. an active binding invokation, a promise forcing leading to the evaluation of such and such expression, etc).