From ab158d7f23cdb475b09136112bc9e36f807d0fd2 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Wed, 10 Jan 2024 08:44:20 -0600 Subject: [PATCH] Remove confusing globalenv() example (#243) Fixes #230 --- R/defer.R | 8 ++------ man/defer.Rd | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/R/defer.R b/R/defer.R index 4d6d9ff..e0d4968 100644 --- a/R/defer.R +++ b/R/defer.R @@ -66,14 +66,10 @@ defer_ns <- environment(defer) #' print(attributes(environment())) #' }) #' -#' # defer and trigger events on the global environment +#' # note that examples lack function scoping so deferred calls will +#' # will be executed immediately #' defer(print("one")) #' defer(print("two")) -#' deferred_run() -#' -#' defer(print("three")) -#' deferred_clear() -#' deferred_run() defer <- function(expr, envir = parent.frame(), priority = c("first", "last")) NULL #' @rdname defer diff --git a/man/defer.Rd b/man/defer.Rd index bdf750a..3b81cf2 100644 --- a/man/defer.Rd +++ b/man/defer.Rd @@ -79,13 +79,9 @@ local({ print(attributes(environment())) }) -# defer and trigger events on the global environment +# note that examples lack function scoping so deferred calls will +# will be executed immediately defer(print("one")) defer(print("two")) -deferred_run() - -defer(print("three")) -deferred_clear() -deferred_run() } \concept{local-related functions}