In package pryr
, there is a function called parent_promise
.
I know what a promise is, but I'm not familiar with the term parent promise. Furthermore, I don't really understand the example in the documentation, perhaps because I don't know what I'm looking for.
library(pryr)
example(parent_promise)
# prnt_p> f <- function(x) g(x)
# prnt_p> g <- function(y) h(y)
# prnt_p> h <- function(z) parent_promise(z)
# prnt_p> h(x + 1)
# x + 1
# prnt_p> g(x + 1)
# x + 1
# prnt_p> f(x + 1)
# x + 1
To help me get a better understanding of the above example, can someone explain what a parent promise is, and if/how it differs from a regular promise?