[Rd] External special functions (SPECIALSXP)

Duncan Murdoch murdoch.duncan at gmail.com
Wed May 25 19:45:06 CEST 2011


On 25/05/2011 1:10 PM, Peter Danenberg wrote:
> Is it possible to define an external special function (SPECIALSXP)?
> I'm trying to do some language-level work, and don't want my arguments
> evaluated before they hit C.
>
> It looks like the only way to define a SPECIALSXP is by using XX0 in
> the `eval' field of R_FunTab; is there any way to make this applicable
> to externally defined functions?


I don't think so.  However, if you don't want to evaluate the arguments, 
just pass substitute(arg) to your function instead of arg.  For example,

  f <- function(a, b) {
    print(substitute(b))
    print(substitute(a))
  }

f( x <- 1, y <- 2 )

will print but never evaluate the assignments.

Duncan Murdoch



More information about the R-devel mailing list