[Rd] R-ints Argument Evaluation has out of date examples

Richard Cotton richierocks at gmail.com
Sat Dec 24 00:24:53 CET 2016


In R-ints section 1.5

https://cran.r-project.org/doc/manuals/r-devel/R-ints.html#Argument-evaluation

it states

> Note that being a special/builtin is separate from being primitive
> or .Internal: quote is a special primitive, + is a builtin primitive,
> cbind is a special .Internal and grep is a builtin .Internal.

I think that the examples of cbind and grep might be out of date since
these both appear to be closures now.

typeof(cbind)
## "closure"
typeof(grep)
## "closure"

In fact, as far as I can tell, all the special and builtin functions
now use the primitive interface.  The following code returns an empty
list in R 3.3.2:

e <- as.environment("package:base")
vars <- mget(ls(e), e)
Filter(
  function(x) {
    typeof(x) %in% c("special", "builtin") && Negate(is.primitive)(x)
  },
  vars
)

Is it true to say that "being a special/builtin is separate from being
primitive on .Internal, however in practice all special and builtin
functions are primitive"?

-- 
Regards,
Richie

Learning R
4dpiecharts.com



More information about the R-devel mailing list