A promise reads the state at the point it is forced, which is wherever the callee first needs it: after the call wrote what the promise reads (g <- function(b) { x <<- 1; b }; g(x)), after another argument did (f(n, n <- 4)), or, once a closure captured its parameter, after the call returned (mk <- function(a) function() a).
A promise reads the state at the point it is forced, which is wherever the callee first needs it: after the call wrote what the promise reads (
g <- function(b) { x <<- 1; b }; g(x)), after another argument did (f(n, n <- 4)), or, once a closure captured its parameter, after the call returned (mk <- function(a) function() a).