% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paintr-default-args.R
\name{ptr_constant_fold_registry}
\alias{ptr_constant_fold_registry}
\alias{ptr_register_constant_fold}
\alias{ptr_clear_constant_fold}
\alias{ptr_constant_fold_keywords}
\title{Constant-fold allowlist registry}
\usage{
ptr_register_constant_fold(name, value)

ptr_clear_constant_fold(name = NULL)

ptr_constant_fold_keywords()
}
\arguments{
\item{name}{Character scalar function or constant name.}

\item{value}{Function or numeric constant to bind under \code{name}.}
}
\value{
\code{\link[=ptr_register_constant_fold]{ptr_register_constant_fold()}} and \code{\link[=ptr_clear_constant_fold]{ptr_clear_constant_fold()}}
return \code{invisible(NULL)}. \code{\link[=ptr_constant_fold_keywords]{ptr_constant_fold_keywords()}} returns a
character vector of currently registered names.
}
\description{
The numeric default-argument validator \code{\link[=ptr_arg_numeric]{ptr_arg_numeric()}} (scalar by
default, vector via \code{vector = TRUE}) walks the placeholder's
default-argument
AST against an allowlist of function and constant names. Authors can
extend the allowlist with \code{\link[=ptr_register_constant_fold]{ptr_register_constant_fold()}} when their
placeholder definitions need additional pure operators.
}
\details{
Built-in entries seeded at package load:
\itemize{
\item Arithmetic: \code{-}, \code{+}, \code{*}, \code{/}, \code{^}, \code{\%\%}, \code{\%/\%}
\item Sequence constructors: \code{:}, \code{c}, \code{seq}, \code{seq.int}, \code{seq_len}, \code{seq_along}
}

Syntactic literals (\code{TRUE}, \code{FALSE}, \code{NA}, \code{NA_integer_}, \code{NA_real_},
\code{Inf}, \code{NaN}) are recognised by the walker directly and never need
registration. \code{pi} resolves through the registry's parent
(\code{baseenv()}).
}
\examples{
ptr_register_constant_fold("log10", log10)
ptr_arg_numeric()(quote(log10(100)))
ptr_clear_constant_fold("log10")
}
