Thanks both

> The other item that might have a relationship to this
> is the ability to a copy an object without evaluating it.  This can't be
> done entirely in R but can be done in C code from R:
> http://tolstoy.newcastle.edu.au/R/e2/devel/07/09/4444.html

> For me, copying is even more important than inspecting and that seems
> to be for Mark's case too.


Gabor's point is spot-on for me (at least, for the first problem I ran across). 
I really do need to store a value (possibly an R_MissingArg token), temporarily 
overwrite it with some other value, then later restore it to whatever condition 
it was in before. There's no evaluation prior to restoration. In fact, given 
the context I'm doing this in, it would be good if I could also copy an 
active-binding or a delayed-eval *without* forcing them-- hadn't thought of 
that. So Gabor's copy-without-forcing would elegantly solve my (first) problem.

> If your code is relying on this behavior then it would be a good idea
> to have a look at your code and figure out why, as there is very
> little useful that can be done with this missing arg token.  If after
> that it turns out that there is a need to be able to test for whether
> a binding represents a missing value then we can look into adding a
> function that tests for this.  There is already sone desire to have a
> way of checking whether a binding contains a delayed evaluation, so
> maybe something like a function bindingStatus that returns one of
> "active", "missing", "delayed" or "evaluated" makes sense.

It would also be great to have 'bindingStatus'. One context is in the 'debug' 
package-- you can imagine the sort of shenanigans that goes on inside that. 
I've been considering re-introducing a watch window, now that there's an 
excellent 'SetTimeLimit' function to pre-empt problems, but I don't want to 
force promises or activate bindings just because an argument variable has been 
added to the watch list.

BTW: re the bug ("Returning the internal R_MissingArg token was a bug."). Is 
the bug that 'get' should force evaluation, or is it that the R_MissingArg is a 
"naked singularity"? I ask because presumably the token will still be "legally" 
available via e.g. 'formals( function(x) NULL)$x'.

NB also that there are one or two other things that can legitimately be done to 
a Missing object, e.g. object.size.  A number of my documentation examples were 
broken by the 'get' change for this kind of reason-- it was late last night 
when I fixed them, and I now can't remember what they all were.

Ah well. I had a nasty feeling somebody might say "we are going to fix the 
other accessors too" since I have just managed to use them to work around the 
new behaviour of 'get'. I almost didn't send the original email, for that 
reason...

Mark

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to