Hi,

I was wondering if it is a good idea to delay the evaluation of expression 
within invisible(), just like data()/delayedAssign()?

The idea is a function might return an invisible object. This object might not 
be used by the users if the function returns are not assigned nor passed to 
another function call. For example,

f <- function() {
  # do something eagerly

  return(invisible({
    # calculate message that might take long/extra memory, but only useful if 
printed out
  }))
}

If `f()` is not immediately assigned to a variable, then there is no reason to 
evaluate invisible(…).

This idea is somewhere between `delayedAssign` and eager evaluation. Maybe we 
could call it delayedInvisible()?

Best,
- Zhengjia

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to