% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/force.R
\name{force_all}
\alias{force_all}
\title{Force evaluation of all arguments to a function}
\usage{
force_all(...)
}
\arguments{
\item{...}{arguments captured by ... are also evaluated if passed via ...}
}
\value{
NULL invisibly
}
\description{
Forces the evaluation of all arguments in the calling
environment of this function.
}
\details{
Use \code{force_all()} as syntactic sugar to force evaluation of
all arguments to a function and thereby circumvent lazy evaluation.
If called from within a function with \code{...} as formal argument,
use \code{force_all(...)} to force evaluation of arguments captured
by \code{...}.
}
\examples{
affine <- function(a, b) {
  function(x) a * x + b
}

a <- 1
b <- 1

affine_11 <- affine(a, b)

a <- 2
b <- 2

affine_11(1) # Gives 4 and not 2 due to lazy evaluation

affine_forced <- function(a, b) {
  force_all()
  function(x) a * x + b
}

a <- 1
b <- 1

affine_11 <- affine_forced(a, b)

a <- 2
b <- 2

affine_11(1) # Gives 2
}
\seealso{
\code{\link[=force]{force()}}
}
