Re ENSURE_NAMEDMAX, I am unsure but think this happens in (src/eval.c@492):
static SEXP forcePromise(SEXP e)
{
if (PRVALUE(e) == R_UnboundValue) {
/* ... SNIP ...*/
val = eval(PRCODE(e), PRENV(e));
/* ... SNIP ...*/
SET_PRSEEN(e, 0);
SET_PRVALUE(e, val);
ENSURE_NAMEDMAX
If you would like more details I wrote about this recently:
https://www.brodieg.com/2019/02/18/an-unofficial-reference-for-internal-inspect/
Basically as soon as you hit a closure R assumes that theargument might still
have a surviving reference to iteven after the closure evaluation ends because
When large calls cause errors R may stall for extended periods. This
is particularly likely to happen with `do.call`, as in this example
with a 24 second stall:
x <- runif(1e7)
system.time(do.call(paste0, list(abs, x))) # intentional error
## Error in (function (..., collapse = NULL