% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils-expr.R
\name{bbquote}
\alias{bbquote}
\alias{.}
\alias{..}
\title{Quoting utilities}
\usage{
bbquote(expr, where = parent.frame(), splice = FALSE)

.(x)

..(x)
}
\arguments{
\item{expr}{A \link[base]{language object}.}

\item{where}{An environment.}

\item{splice}{Logical; if \code{TRUE} splicing is enabled.}

\item{x}{Object}
}
\value{
A language object in the same way as returned by \code{\link[base:bquote]{base::bquote()}}.
Functions \code{.()} and \code{..()} throw errors when invoked an only exist to mask
check notes "no visible global function definition" for their use.
}
\description{
Block expressions in blockr are evaluated in a 2-step manner: first in the
context of arguments supplied by the user via UI elements and in a second
step in the context of input data. The function \code{\link[base:bquote]{base::bquote()}} does not
allow for terms wrapped in \code{.()} or \code{..()} to be missing and this makes it
incompatible with this 2-step approach. A drop-in replacement, provided as
\code{bbquote()} addresses this shortcoming.
}
\details{
A block like \code{new_head_block()} is expected to return an expression of the
form \code{utils::head(data, n = 10L)}, which will then be evaluated in an
environment where he have a name \code{data} bound to some dataset. In order to
perform some manipulations of such block expressions it is required to
somehow mark the terms that correspond to input data and for that we can
use the syntax introduced by \code{\link[base:bquote]{base::bquote()}}. What we would prefer to have
as block expression therefore is not the above, but something like
\code{utils::head(.(data), n = 10L)}, as this affords us more possibilities for
performing substitutions (and therefore generates cleaner code).

In order to interpolate certain arguments in a first step, we unfortunately
cannot use \code{\link[base:bquote]{base::bquote()}}, but we can use \code{bbquote()} instead to generate
the desired expression.

\if{html}{\out{<div class="sourceCode r">}}\preformatted{bquote(utils::head(.(data), n = .(n)), list(n = 10L))
#> Error in eval(e[[2L]], where) : object 'data' not found
bbquote(utils::head(.(data), n = .(n)), list(n = 10L))
#> utils::head(.(data), n = 10L)
}\if{html}{\out{</div>}}

This also works with \code{..()} and splicing.
}
\examples{
bbquote(utils::head(.(data), n = .(n)), list(n = 10L))
bbquote(c(.(a), ..(bc)), list(a = "a"))
bbquote(c(.(a), ..(bc)), list(a = "a", bc = c("b", "c")), splice = TRUE)

}
