From murdoch.duncan at gmail.com  Wed May 25 19:45:06 2011
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Wed, 25 May 2011 13:45:06 -0400
Subject: [Rd] External special functions (SPECIALSXP)
In-Reply-To: <20110525171038.GA21186@klutometis.wikitex.org>
References: <20110525171038.GA21186@klutometis.wikitex.org>
Message-ID: <4DDD4022.5060001@gmail.com>

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



[Rd] External special functions (SPECIALSXP)
Duncan Murdoch