Skip to content

PROTECT and OCaml GC.

3 messages · Guillaume Yziquel

#
Simon Urbanek a ?crit :
The small example you gave just works out fine with the framework I've 
been building so far:
This is administrativia.
So after evaluating the parsed output of "function(x) x + 1", you indeed 
get a pure closure. So far so good.
Here's the argument, 11.
Here's the call that is built out of the closure and 11. For 
construction details, the C function is given at the bottom.
And it gets correctly evaluated. So this is fine. In fact, it works on 
the majority of the things I try. So I guess I've been building it fine. 
What's not fine is the following, from the quantmod package:
s is a STRSXP vector containing only one string: "YHOO".
g is the getSymbols function from quantmod. From the help(getSymbols) 
invocation:
So I try out getSymbols("YHOO"). It works out fine, and returns silently 
in the R toplevel.

But, from my binding:
Here are the values of s and g:
For the sake of exhaustivity, here's the C functions that I wrote to 
make function calls:
and
So I'm almost constructing LANGSXP lists in the way you do.

One last thing, concerning the use of promises. If I do install, 
findVar, without forcing the resulting promise, and then construct the 
call, I get a failure:
If I force the promises:
It works.

So you may say that "I'm not constructing it right", I still believe 
that describing precisely what kind of arguments is accepted by eval 
would a good thing.

All the best,
#
Guillaume Yziquel a ?crit :
It seems that Matjaz Kukar had the same kind of issue that I have with 
usemethod:

	http://tolstoy.newcastle.edu.au/R/devel/04/10/0902.html

I just remark two things from the resulting thread:

-1- He asks where to find a more precise documentation of the R API, 
which is also something I'd be looking for,

-2- He has been suggested to use findVar1, which doesn't seem to be part 
of the API.

Will be looking into findVar1, findFun, findVar, though I do not 
understand why this fails in my case. Please feel free to enlighten me.

All the best,
#
Guillaume Yziquel a ?crit :
Replacing findfun by findvar works in this specific case. See below.

Could someone explain why findfun works while findvar doesn't? I've been 
looking at the source code in envir.c, and it isn't really clear why one 
way works while the other doesn't.

Is it possible, given a variable/function name, to determine if it 
should use findFun or findVar? This would be helpful for the polymorphic 
static typing of R values.
findFun works.
findVar doesn't.
All the best,