Re: [Rd] problem with findFun call from embedded R

From: Joe Conway <>
Date: Fri, 06 Jul 2007 10:35:41 -0700

Jeffrey Horner wrote:
> Joe Conway wrote:

>> I was debugging a problem reported to me regarding PL/R, and found 
>> that I can duplicate it using only R sources. It might be 
>> characterized as possibly a misuse of the findFun() function, but I 
>> leave that for the R devel experts to decide.

>> My question is -- is the above an abuse of findFun() by RNamedCall.c 
>> (meaning I should avoid the same pattern)? Or maybe it should be >> wrapped in something similar to R_ToplevelExec?

> Yes, when one embeds R, findFun() will call error() which causes the
> longjmp() to the top level, so the embedding application shouldn't use
> findFun().

OK, thanks for the confirmation. I just wonder if RNamedCall.c ought to be changed then...

> Here's what I've written for the next version of RApache. Note that
> it's behavior is slightly different than the original findFun(), in that
> it doesn't search the enclosing environments. (Also, comments welcome as
> the implementation is based on the original, and I'm unsure if promise
> evaluation is needed.)
> /* This one doesn't longjmp when function not found */
> static SEXP MyfindFun(SEXP symb, SEXP envir){

Yes, if I patch RNamedCall.c with the attached (based on your function), everything seems to work.


Joe mailing list
Received on Fri 06 Jul 2007 - 17:38:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 06 Jul 2007 - 19:35:55 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.